Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,35 @@ jobs:
- id: bump-version
run: |
cz bump --yes
current_version="v$(cz version -p)"

new_version="v$(cz version -p)"
major_version="v$(cz version -p --major)"
echo "current_version=$current_version" >> $GITHUB_OUTPUT
new_version_tag="$(cz version -p --tag)"

echo "new_version=$new_version" >> $GITHUB_OUTPUT
echo "major_version=$major_version" >> $GITHUB_OUTPUT
echo "new_version_tag=$new_version_tag" >> $GITHUB_OUTPUT
- name: Update major tag
env:
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
NEW_VERSION: ${{ steps.bump-version.outputs.new_version }}
MAJOR_VERSION: ${{ steps.bump-version.outputs.major_version }}
run: |
# Push new commit + new tag
git push --follow-tags

# Move major tag to the latest commit
git tag -fa "${MAJOR_VERSION}" -m "release ${CURRENT_VERSION}"
git tag -fa "${MAJOR_VERSION}" -m "release ${NEW_VERSION}"

# Force push new major tag
git push origin "${MAJOR_VERSION}" -f
- name: Build changelog
env:
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
NEW_VERSION: ${{ steps.bump-version.outputs.new_version }}
run: |
cz changelog --dry-run "${CURRENT_VERSION}" > .changelog.md
cz changelog --dry-run "${NEW_VERSION}" > .changelog.md
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: ".changelog.md"
tag_name: ${{ steps.bump-version.outputs.current_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
NEW_VERSION_TAG: ${{ steps.bump-version.outputs.new_version_tag }}
run: |
gh release create "${NEW_VERSION_TAG}" --notes-file .changelog.md
19 changes: 10 additions & 9 deletions examples/bump-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ jobs:
run: |
cz bump --yes --annotated-tag
git push --follow-tags
current_version="$(cz version -p)" # ATTENTION: You may have to add the v* at the beginning of the version
echo "current_version=$current_version" >> $GITHUB_OUTPUT
new_version="$(cz version -p)" # ATTENTION: You may have to add the v* at the beginning of the version
new_version_tag="$(cz version -p --tag)"
echo "new_version=$new_version" >> $GITHUB_OUTPUT
echo "new_version_tag=$new_version_tag" >> $GITHUB_OUTPUT
- name: Build changelog for Release
env:
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
NEW_VERSION: ${{ steps.bump-version.outputs.new_version }}
run: |
cz changelog --dry-run "${CURRENT_VERSION}" > .changelog.md
cz changelog --dry-run "${NEW_VERSION}" > .changelog.md
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: ".changelog.md"
tag_name: ${{ steps.bump-version.outputs.current_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
NEW_VERSION_TAG: ${{ steps.bump-version.outputs.new_version_tag }}
run: |
gh release create "${NEW_VERSION_TAG}" --notes-file .changelog.md
2 changes: 1 addition & 1 deletion examples/trigger-other-job/.github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ flowchart LR
release --> workflow_dispatch
end

subgraph TM["trigger-me"]
subgraph TM["release"]
echo_version["echo version"]
end

Expand Down
26 changes: 15 additions & 11 deletions examples/trigger-other-job/.github/workflows/bump-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,29 @@ jobs:
python-version: "3.x"
- id: bump-version
run: |
old_version="$(cz version -p)"
cz bump --yes --annotated-tag
git push --follow-tags
current_version="$(cz version -p)" # ATTENTION: You may have to add the v* at the beginning of the version
echo "current_version=$current_version" >> $GITHUB_OUTPUT
new_version="$(cz version -p)"
new_version_tag="$(cz version -p --tag)"

echo "old_version=$old_version" >> $GITHUB_OUTPUT
echo "new_version=$new_version" >> $GITHUB_OUTPUT
echo "new_version_tag=$new_version_tag" >> $GITHUB_OUTPUT
- name: Build changelog for Release
env:
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
NEW_VERSION: ${{ steps.bump-version.outputs.new_version }}
run: |
cz changelog --dry-run "${CURRENT_VERSION}" > .changelog.md
cz changelog --dry-run "${NEW_VERSION}" > .changelog.md
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: ".changelog.md"
tag_name: ${{ steps.bump-version.outputs.current_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
NEW_VERSION_TAG: ${{ steps.bump-version.outputs.new_version_tag }}
run: |
gh release create "${NEW_VERSION_TAG}" --notes-file .changelog.md
- name: trigger other workflow
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run .github/workflows/trigger-me.yaml \
-f "version=${{ steps.bump-version.outputs.current_version }}"
gh workflow run release.yaml \
-f "version=${{ steps.bump-version.outputs.new_version_tag }}"
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ on:
required: true

jobs:
triggered-echo:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ inputs.version }}
- name: Trigger other job
run: |
echo "Version: ${{ inputs.version }}"
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading