Skip to content

Refactor gitflow workflows #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/auto_merge_release_hotfix_into_develop.yaml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/create_release_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: create_release_pr

on:
push:
branches:
- "release/**"
- "hotfix/**"

jobs:
create_release_pr:
name: Create release pull request
runs-on: ubuntu-latest
permissions:
contents: write
# only create draft pull requests on
# pushing to branches 'release/' or 'hotfix/'
if: |
startsWith(github.ref_name, 'release/') ||
startsWith(github.ref_name, 'hotfix/')

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
token: ${{ secrets.GH_TOKEN }}
# needed by "gh pr create"
fetch-depth: 0

- name: Set release type as release
if: startsWith(github.ref_name, 'release/')
run: echo "RELEASE_TYPE=release" >> "$GITHUB_ENV"

- name: Set release type as hotfix
if: startsWith(github.ref_name, 'hotfix/')
run: echo "RELEASE_TYPE=hotfix" >> "$GITHUB_ENV"

- name: Create release pull request
uses: ghacts/gitflow/create-release-pr@main
with:
token: ${{ secrets.GH_TOKEN }}
release-type: ${{ env.RELEASE_TYPE }}
release-branch-prefix: '${{ env.RELEASE_TYPE }}/'
86 changes: 0 additions & 86 deletions .github/workflows/draft_release_hotfix_pr.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/merge_release_into_develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: merge_release_into_develop

on:
pull_request:
types:
- opened
branches:
- develop

jobs:
merge_release_into_develop:
name: Merge release into develop
runs-on: ubuntu-latest
permissions:
contents: write
# only merge pull requests that begin with 'release/' or 'hotfix/'
if: |
startsWith(github.head_ref, 'release/') ||
startsWith(github.head_ref, 'hotfix/')

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
# needed by "gh pr create"
fetch-depth: 0

- name: Merge ${{ github.head_ref }} into develop
uses: ghacts/gitflow/merge-release-into-develop@main
with:
token: ${{ secrets.GH_TOKEN }}
release-branch: ${{ github.head_ref }}
develop-branch: develop
54 changes: 54 additions & 0 deletions .github/workflows/publish_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: publish_release

on:
pull_request:
types:
- closed
branches:
- main

env:
VERSION_TAG_PREFIX: "v"

jobs:
release:
name: Publish release
runs-on: ubuntu-latest
permissions:
contents: write
# only merge pull requests that begin with 'release/' or 'hotfix/'
if: github.event.pull_request.merged == true &&
(startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/'))

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
# needed by "gh pr create"
fetch-depth: 0

- name: Set release type as release
if: startsWith(github.head_ref, 'release/')
run: echo "RELEASE_TYPE=release" >> "$GITHUB_ENV"

- name: Set release type as hotfix
if: startsWith(github.head_ref, 'hotfix/')
run: echo "RELEASE_TYPE=hotfix" >> "$GITHUB_ENV"

- name: Extract version from release branch
env:
BRANCH_NAME: ${{ github.head_ref }}
BRANCH_PREFIX: '${{ env.RELEASE_TYPE }}/'
run: |
RELEASE_VERSION=${BRANCH_NAME#${BRANCH_PREFIX}}
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV

- name: Publish release
uses: ghacts/gitflow/publish-release@main
with:
token: ${{ secrets.GH_TOKEN }}
release-type: ${{ env.RELEASE_TYPE }}
release-branch-prefix: '${{ env.RELEASE_TYPE }}/'
notes-file: '.changes/${{ env.VERSION_TAG_PREFIX }}${{ env.RELEASE_VERSION }}.md'
86 changes: 0 additions & 86 deletions .github/workflows/release.yaml

This file was deleted.