Skip to content

Instantly share code, notes, and snippets.

@GuillaumeFalourd
Last active March 7, 2023 16:58
Show Gist options
  • Save GuillaumeFalourd/21168daa81e931e37b6c5d2bd9a74e13 to your computer and use it in GitHub Desktop.
Save GuillaumeFalourd/21168daa81e931e37b6c5d2bd9a74e13 to your computer and use it in GitHub Desktop.
Gist related to a Git Flow article using Release Candidate Branches for deploy
name: Create release
on:
pull_request:
types:
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tag:
if: contains(github.head_ref, 'release-') && contains(github.base_ref, 'main') && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Extract branch tag
id: tag
run: |
BRANCH=${{ github.head_ref }}
TAG="${BRANCH//release-/""}"
echo $TAG
echo "tag=$TAG" >> $GITHUB_OUTPUT
release:
needs:
- TAG
runs-on: ubuntu-latest
env:
TAG: ${{ needs.TAG.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Push tag
uses: mathieudutour/github-tag-action@v6.1
with:
custom_tag: ${{ env.TAG }}
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.TAG }}
tag_name: ${{ env.TAG }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment