Skip to content

Improvement: Automate the creation of a version tag on a monthly basis #17

Improvement: Automate the creation of a version tag on a monthly basis

Improvement: Automate the creation of a version tag on a monthly basis #17

Workflow file for this run

name: Create a new version tag
on:
pull_request:
workflow_dispatch:
schedule:
# trigger at 0:00 on the first day of each month
- cron: '0 0 1 * *'
jobs:
monthly_release:
runs-on: ubuntu-latest
steps:
#checkout main branch
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: main
persist-credentials: false
# Create version name accessible in the following steps
- name: Set version name
run: echo "VERSION_NAME=v4.0.0-$(date +'%Y.%m.%d')" >> $GITHUB_ENV
#create a new branch for the version tag
- name: Create version tag
run: |
git checkout -b new_version_${{ env.VERSION_NAME }}
git config user.email "[email protected]"
git config user.name "t8ddy"
# configure remote to use the secret token for pushing
git remote set-url origin https://x-access-token:${{ secrets.T8DDY_TOKEN }}@github.com/${{ github.repository }}
git tag "${{ env.VERSION_NAME }}"
git push --set-upstream origin new_version_${{ env.VERSION_NAME }}
git push origin --tags
# Create a PR for the new version tag
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.T8DDY_TOKEN }}
commit-message: "Create new version tag ${{ env.VERSION_NAME }}"
title: "Create new version tag ${{ env.VERSION_NAME }}"
body: "This PR creates a new version tag ${{ env.VERSION_NAME }} for the monthly release."
base: main
branch: new_version_${{ env.VERSION_NAME }}