Skip to content

cd: Configure github actions bot correctly #9

cd: Configure github actions bot correctly

cd: Configure github actions bot correctly #9

Workflow file for this run

name: Release on Tag
on:
push:
tags:
- 'v*.*.*'
env:
VERSION:
permissions:
contents: write
actions: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout triggering tag
uses: actions/checkout@v4
- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- 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
uses: actions/checkout@v4
with:
ref: main
- name: Get the version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
- name: Update version number in script
run: |
version=${{ env.VERSION }}
major=$(echo $version | cut -d. -f1)
minor=$(echo $version | cut -d. -f2)
patch=$(echo $version | cut -d. -f3)
patch=$((patch + 1))
new_version="$major.$minor.$patch"
sed -i "s/^current_version=.*/current_version=\"$new_version\"/" 42free.sh
git add 42free.sh
git commit -m "bot: Update version number to $new_version"
git push origin main