Skip to content

Fix the bump version push #23

Fix the bump version push

Fix the bump version push #23

Workflow file for this run

name: Bump Version
on:
pull_request:
jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache semrel build
id: cache-semrel
uses: actions/cache@v2
with:
path: target/release/semrel
key: ${{ runner.os }}-semrel-${{ hashFiles('**/Cargo.lock') }}
- name: Check if semrel is cached
id: semrel-check
run: |
if [ -f target/release/semrel ]; then
echo "::set-output name=cached::true"
else
echo "::set-output name=cached::false"
fi
- name: Build semrel
if: steps.semrel-check.outputs.cached != 'true'
run: cargo build --release
- name: Update version
run: ./target/release/semrel update
- name: Get new version
id: set-new-version
run: echo "::set-output name=version::$(./target/release/semrel show current)"
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git stash
git fetch origin/main
git rebase origin/main
git stash pop
git add .
git commit -m "release: ${{ steps.set-new-version.outputs.version }} "
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push origin HEAD:main