Skip to content

Commit

Permalink
Add release branch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xschildw committed Sep 6, 2024
1 parent 562b167 commit 0a4d9f0
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- id: extract_release
run: |
branch_name="${GITHUB_REF#refs/heads/}"
if [[ $branch_name =~ ^release-([0-9]+)$ ]]; then
release_number=${BASH_REMATCH[1]}
echo "release_number=$release_number" >> $GITHUB_ENV
else
echo "Invalid branch name format"
exit 1
fi
- id: git_config
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- id: push_prod_tag
run: |
tag_name="${release_number}.1"
git tag -a $tag_name -m stack-${release_number}-prod
git push origin $tag_name
- id: create_new_release_branch
run: |
git checkout develop
next_release_number=$((release_number + 1))
new_branch="release-${next_release_number}"
git checkout -b $new_branch
new_tag="${next_release_number}.0"
git tag -a $new_tag -m stack-${next_release_number}-staging
git push origin $new_branch

0 comments on commit 0a4d9f0

Please sign in to comment.