Skip to content

Commit 4124100

Browse files
authored
ci(mirror): mirror dynamic tag updates (#299)
mirror dynamic tags
1 parent 0930506 commit 4124100

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

.github/scripts/update_dynamic_tags.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ for t in "$MAJOR_TAG" "$MINOR_TAG" "$NEW_TAG"; do
8383
sha=$(echo "$resp" | jq -r '.object.sha')
8484
echo " $t -> $sha"
8585
done
86+
87+
# Output tags for the next steps
88+
echo "major=$MAJOR_TAG" >> $GITHUB_OUTPUT
89+
echo "minor=$MINOR_TAG" >> $GITHUB_OUTPUT
90+
echo "patch=$NEW_TAG" >> $GITHUB_OUTPUT

.github/workflows/mirror.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ jobs:
4141
EVENT_TYPE: >-
4242
${{
4343
contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && 'mirror-push' ||
44-
github.event_name == 'workflow_call' && 'mirror-tag' ||
45-
github.event_name == 'delete' && 'mirror-delete-ref' || ''
44+
github.event_name == 'delete' && 'mirror-delete-ref' ||
45+
inputs.released-tag != null && 'mirror-tag' || ''
4646
}}
4747
PAYLOAD_KEY: >-
4848
${{
4949
contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && 'source_branch' ||
50-
github.event_name == 'workflow_call' && 'tag_name' ||
51-
github.event_name == 'delete' && 'delete_ref' || ''
50+
github.event_name == 'delete' && 'delete_ref' ||
51+
inputs.released-tag != null && 'tag_name' || ''
5252
}}
5353
PAYLOAD_VALUE: >-
5454
${{
5555
contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.ref_name ||
56-
github.event_name == 'workflow_call' && inputs.released-tag ||
57-
github.event_name == 'delete' && github.event.ref || ''
56+
github.event_name == 'delete' && github.event.ref ||
57+
inputs.released-tag != null && inputs.released-tag || ''
5858
}}
5959
steps:
6060
- name: Trigger ${{ env.EVENT_TYPE}} with payload ${{ env.PAYLOAD_KEY}}=${{ env.PAYLOAD_VALUE}}

.github/workflows/release.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ jobs:
4747
contents: write
4848
pull-requests: write
4949
outputs:
50-
tag_name: ${{ steps.publish_release.outputs.tag_name }}
50+
major_tag: ${{ steps.update_tags.outputs.major }}
51+
minor_tag: ${{ steps.update_tags.outputs.minor }}
52+
patch_tag: ${{ steps.update_tags.outputs.patch }}
5153
steps:
5254
- uses: actions/checkout@v4
5355

@@ -60,22 +62,26 @@ jobs:
6062
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6163

6264
- name: Update/create dynamic tags
65+
id: update_tags
6366
env:
6467
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6568
run: >
6669
.github/scripts/update_dynamic_tags.sh "${{ steps.publish_release.outputs.tag_name }}"
6770
6871
trigger-mirror:
69-
name: Trigger tag mirroring workflow
72+
name: Trigger tag mirroring
7073
needs: release
74+
strategy:
75+
matrix:
76+
released-tag: ["${{ needs.release.outputs.major_tag }}", "${{ needs.release.outputs.minor_tag }}", "${{ needs.release.outputs.patch_tag }}"]
7177
uses: ./.github/workflows/mirror.yml
7278
with:
73-
released-tag: ${{ needs.release.outputs.tag_name }}
79+
released-tag: ${{ matrix.released-tag }}
7480

7581
post:
7682
name: Post Action
7783
runs-on: ubuntu-latest
78-
needs: release
84+
needs: trigger-mirror
7985
if: always()
8086
steps:
8187
# Check status of the worklfow

0 commit comments

Comments
 (0)