Merge pull request #20 from weseek/support/update-condition-rule-in-m… #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update draft | |
permissions: | |
pull-requests: write | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
- dev/*.*.* | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
# Refs: https://github.com/release-drafter/release-drafter | |
update-release-draft: | |
runs-on: ubuntu-latest | |
outputs: | |
CURRENT_VERSION: ${{ steps.package-json.outputs.packageVersion }} | |
RELEASE_DRAFT_BODY: ${{ steps.release-drafter.outputs.body }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Retrieve information from package.json | |
uses: myrotvorets/info-from-package-json-action@2.0.0 | |
id: package-json | |
# Drafts your next Release notes as Pull Requests are merged into "main" | |
- uses: release-drafter/release-drafter@v5 | |
id: release-drafter | |
with: | |
name: v${{ steps.package-json.outputs.packageVersion }} | |
tag: v${{ steps.package-json.outputs.packageVersion }} | |
version: ${{ steps.package-json.outputs.packageVersion }} | |
disable-autolabeler: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Refs: https://github.com/bakunyo/git-pr-release-action | |
update-release-pr: | |
needs: update-release-draft | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get release version | |
id: release-version | |
run: | | |
RELEASE_VERSION=`npx semver -i patch ${{ needs.update-release-draft.outputs.CURRENT_VERSION }}` | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT | |
- name: Get base branch | |
id: base-branch | |
run: | | |
GITHUB_REF_NAME=${{ github.ref_name }} | |
WILDCARD_VERSION=${GITHUB_REF_NAME#dev/} | |
# set "release/current" or "release/X.X.x" to BASE_BRANCH | |
BASE_BRANCH=release/${{ github.ref_name == 'main' && 'current' || '$WILDCARD_VERSION' }} | |
echo "BASE_BRANCH=$BASE_BRANCH" >> $GITHUB_OUTPUT | |
- name: Create/Update Pull Request | |
uses: bakunyo/git-pr-release-action@master | |
with: | |
# Overwrite everything so that the old content does not remain in the release notes, if the label attached to the PR changes | |
args: --overwrite-description | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_PR_RELEASE_BRANCH_PRODUCTION: ${{ steps.base-branch.outputs.BASE_BRANCH }} | |
GIT_PR_RELEASE_BRANCH_STAGING: ${{ github.ref_name }} | |
GIT_PR_RELEASE_TEMPLATE: .github/git-pr-release-template.erb | |
GIT_PR_RELEASE_TITLE: Release v${{ steps.release-version.outputs.RELEASE_VERSION }} | |
GIT_PR_RELEASE_BODY: ${{ needs.update-release-draft.outputs.RELEASE_DRAFT_BODY }} |