Skip to content

Commit 68dcaf5

Browse files
committed
fix(examples): improve trigger-other-job
1 parent 578def5 commit 68dcaf5

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

examples/trigger-other-job/.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ flowchart LR
1919
release --> workflow_dispatch
2020
end
2121
22-
subgraph TM["trigger-me"]
22+
subgraph TM["release"]
2323
echo_version["echo version"]
2424
end
2525

examples/trigger-other-job/.github/workflows/bump-release.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,30 @@ jobs:
2222
python-version: "3.x"
2323
- id: bump-version
2424
run: |
25+
old_version="$(cz version -p)"
2526
cz bump --yes --annotated-tag
2627
git push --follow-tags
27-
current_version="$(cz version -p)" # ATTENTION: You may have to add the v* at the beginning of the version
28-
echo "current_version=$current_version" >> $GITHUB_OUTPUT
28+
new_version="$(cz version -p)"
29+
new_version_tag="$(cz version -p --tag)"
30+
31+
echo "old_version=$old_version" >> $GITHUB_OUTPUT
32+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
33+
echo "new_version_tag=$new_version_tag" >> $GITHUB_OUTPUT
2934
- name: Build changelog for Release
3035
env:
31-
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
36+
NEW_VERSION: ${{ steps.bump-version.outputs.new_version }}
3237
run: |
33-
cz changelog --dry-run "${CURRENT_VERSION}" > .changelog.md
38+
cz changelog --dry-run "${NEW_VERSION}" > .changelog.md
3439
- name: Release
3540
uses: softprops/action-gh-release@v2
3641
with:
3742
body_path: ".changelog.md"
38-
tag_name: ${{ steps.bump-version.outputs.current_version }}
43+
tag_name: ${{ steps.bump-version.outputs.new_version }}
3944
env:
4045
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4146
- name: trigger other workflow
4247
env:
4348
GH_TOKEN: ${{ github.token }}
4449
run: |
45-
gh workflow run .github/workflows/trigger-me.yaml \
46-
-f "version=${{ steps.bump-version.outputs.current_version }}"
50+
gh workflow run release.yaml \
51+
-f "version=${{ steps.bump-version.outputs.new_version_tag }}"

examples/trigger-other-job/.github/workflows/trigger-me.yaml renamed to examples/trigger-other-job/.github/workflows/release.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ on:
66
required: true
77

88
jobs:
9-
triggered-echo:
9+
release:
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
ref: ${{ inputs.version }}
1217
- name: Trigger other job
1318
run: |
1419
echo "Version: ${{ inputs.version }}"

0 commit comments

Comments
 (0)