Merge pull request #45 from edwardtfn/new-versioning-02 #10
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
# Workflow for managing versioning, tagging, and temporary branches | |
--- | |
name: Version Bump and Tag | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/VERSION' | |
- '**/VERSION_YAML' | |
workflow_dispatch: | |
inputs: | |
update_stable: | |
description: "Update stable tag?" | |
required: true | |
default: "false" | |
jobs: | |
versioning: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Create Temporary Branch | |
run: | | |
TEMP_BRANCH="temp/version-bump-$(uuidgen)" | |
echo "TEMP_BRANCH=${TEMP_BRANCH}" >> "${GITHUB_ENV}" | |
git checkout -b "${TEMP_BRANCH}" | |
- name: Bump Version | |
run: | | |
chmod +x ./versioning/bump_version.sh | |
./versioning/bump_version.sh | |
- name: Push Changes to Temporary Branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" HEAD | |
- name: Merge Changes into Main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git checkout main | |
git pull "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" main | |
git merge --no-ff "$TEMP_BRANCH" -m "Automated Version Bump [skip-versioning]" | |
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" main | |
- name: Delete Temporary Branch | |
if: always() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" --delete "$TEMP_BRANCH" | |
... |