Skip to content

Commit c1de0ad

Browse files
committed
ci(release): Make workflows dependent on release completion
1 parent 396def3 commit c1de0ad

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

.github/workflows/docs_deploy.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Documentation Build and Production Deploy CI
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_run:
5+
workflows: ["ESP32 Arduino Release"]
6+
types:
7+
- completed
68
push:
79
branches:
810
- release/v2.x
@@ -12,14 +14,18 @@ on:
1214
- '.github/workflows/docs_deploy.yml'
1315

1416
jobs:
15-
1617
deploy-prod-docs:
1718
name: Deploy Documentation on Production
1819
runs-on: ubuntu-22.04
1920
defaults:
2021
run:
2122
shell: bash
2223
steps:
24+
- name: Check if release workflow is successful
25+
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' }}
26+
run: |
27+
echo "Release workflow failed. Exiting..."
28+
exit 1
2329
- uses: actions/checkout@v4
2430
with:
2531
submodules: true
+27-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
11
name: Push components to https://components.espressif.com
2+
23
on:
3-
push:
4-
tags:
5-
- '*'
4+
workflow_run:
5+
workflows: ["ESP32 Arduino Release"]
6+
types:
7+
- completed
8+
69
jobs:
710
upload_components:
811
runs-on: ubuntu-latest
912
steps:
13+
- name: Get the release tag
14+
run: |
15+
if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then
16+
echo "Release workflow failed. Exiting..."
17+
exit 1
18+
fi
19+
20+
branch=${{ github.event.workflow_run.head_branch }}
21+
if [[ $branch == refs/tags/* ]]; then
22+
tag="${branch#refs/tags/}"
23+
elif [[ $branch =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
24+
tag=$branch
25+
else
26+
echo "Tag not found in $branch. Exiting..."
27+
exit 1
28+
fi
29+
30+
echo "Tag: $tag"
31+
echo "RELEASE_TAG=$tag" >> $GITHUB_ENV
32+
1033
- uses: actions/checkout@v4
1134
with:
1235
submodules: "recursive"
@@ -15,6 +38,6 @@ jobs:
1538
uses: espressif/upload-components-ci-action@v1
1639
with:
1740
name: arduino-esp32
18-
version: ${{ github.ref_name }}
41+
version: ${{ env.RELEASE_TAG }}
1942
namespace: espressif
2043
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}

0 commit comments

Comments
 (0)