cd: Update version number in script after each release #4
Workflow file for this run
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: Release on Tag | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
env: | |
VERSION: | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Git | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
- name: Release and Upload Asset | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: 42free.sh | |
generate_release_notes: true | |
make_latest: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout main branch | |
run: | | |
git checkout main | |
git pull | |
- name: Get the version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV" | |
- name: Update version number in script | |
run: | | |
sed -i "s/^current_version=.*/current_version=\"${{ env.VERSION }}\"/" 42free.sh | |
git add 42free.sh | |
git commit -m "bot: Update version number to ${{ env.VERSION }}" | |
git push origin main |