Update release.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tag and Release | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
workflow_dispatch: | |
jobs: | |
TagStage: | |
name: Bump Git Tag with Semverbot | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }} | |
steps: | |
- name: Checkout Source Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository }} | |
ref: ${{ github.ref }} | |
persist-credentials: true | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' # Specify the Python version you need | |
- name: Install Semverbot | |
run: | | |
SEMVERBOT_VERSION=1.0.0 | |
mkdir bin | |
echo "$(pwd)/bin" >> $GITHUB_PATH | |
curl -o bin/sbot -L https://github.com/restechnica/semverbot/releases/download/v$SEMVERBOT_VERSION/sbot-linux-amd64 | |
chmod +x bin/sbot | |
- name: Set up Git | |
run: | | |
git config --global user.name 'semverbot' | |
git config --global user.email '[email protected]' | |
- name: Bump Git Tag to Next Version | |
run: | | |
semverbot bump \ | |
--working-directory "${{ github.workspace }}" \ | |
--config-file "${{ github.workspace }}/template-repo/src/pipelines/shared/config/semverbot-config.toml" \ | |
--branch "${{ github.ref_name }}" \ | |
--git-user-email "[email protected]" \ | |
--git-user-name "semverbot" | |
- name: Add Current and Next Version Tags | |
run: | | |
echo "::set-output name=current_version::$(semverbot predict --current)" | |
echo "::set-output name=next_version::$(semverbot predict --next)" | |
- name: Push New Tag to Repository | |
run: | | |
git push origin --tags | |
- name: Add Tags as Build Metadata | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const currentVersion = '${{ steps.BumpGitTag.outputs.current_version }}'; | |
const nextVersion = '${{ steps.BumpGitTag.outputs.next_version }}'; | |
core.setOutput('current_version', currentVersion); | |
core.setOutput('next_version', nextVersion); | |
core.info(`Current version: ${currentVersion}`); | |
core.info(`Next version: ${nextVersion}`); |