-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from khanh-ph/release/4.0.0
Release version 4.0.0
- Loading branch information
Showing
11 changed files
with
226 additions
and
122 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,23 @@ jobs: | |
run: git push origin ${{ env.BRANCH }} | ||
|
||
- name: Create a Pull Request | ||
uses: thomaseizinger/[email protected] | ||
uses: actions/github-script@v6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
base: master | ||
head: ${{ env.BRANCH }} | ||
title: Release version ${{ env.VERSION }} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const version = process.env.VERSION; | ||
const title = 'Release version ' + version; | ||
const body = 'Created by GitHub Actions'; | ||
const base = 'master'; | ||
const head = process.env.BRANCH; | ||
github.rest.pulls.create({ | ||
owner, | ||
repo, | ||
title, | ||
body, | ||
base, | ||
head | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
name: Publish Release to GitHub | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
|
@@ -10,31 +11,56 @@ jobs: | |
publish-a-release: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') | ||
|
||
steps: | ||
- name: Extract version from branch name (for release branches) | ||
if: startsWith(github.event.pull_request.head.ref, 'release/') | ||
- name: Extract version from branch name | ||
run: | | ||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
VERSION=${BRANCH_NAME#release/} | ||
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Create Release | ||
uses: thomaseizinger/[email protected] | ||
env: | ||
set -x | ||
branchName="${{ github.event.pull_request.head.ref }}" | ||
version=${branchName#release/} | ||
if [[ "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-rc\.([0-9]+))?$ ]]; then | ||
echo "TAG=$version" >> $GITHUB_ENV | ||
else | ||
echo "$version is not a supported semver." >&2 | ||
exit 1 | ||
fi | ||
- name: Create Release to GitHub | ||
uses: actions/github-script@v6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
target_commitish: ${{ github.event.pull_request.merge_commit_sha }} | ||
tag_name: ${{ env.RELEASE_VERSION }} | ||
name: v${{ env.RELEASE_VERSION }} | ||
draft: false | ||
prerelease: false | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const target_commitish = context.sha; | ||
- name: Merge master into develop branch (Gitflow) | ||
uses: thomaseizinger/[email protected] | ||
env: | ||
github.rest.repos.createRelease({ | ||
owner, | ||
repo, | ||
tag_name: process.env.TAG, | ||
target_commitish, | ||
name: `v${process.env.TAG}`, | ||
generate_release_notes: true, | ||
draft: process.env.TAG.includes('-rc'), | ||
prerelease: false | ||
}); | ||
- name: Create a PR to merge master back into develop branch | ||
uses: actions/github-script@v6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
head: master | ||
base: develop | ||
title: Merge master into develop branch (Gitflow) | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const title = `Merge master into develop after publishing release ${process.env.TAG}`; | ||
const body = 'Created by GitHub Actions'; | ||
const base = 'develop'; | ||
const head = 'master'; | ||
github.rest.pulls.create({ | ||
owner, | ||
repo, | ||
title, | ||
body, | ||
base, | ||
head | ||
}); |
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
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
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
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
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
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
Oops, something went wrong.