Release version 0.1.5 to master #4
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: "Release Workflow V2" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "The version you want to release." | |
required: true | |
pull_request: | |
branches: | |
- master | |
types: | |
- closed | |
jobs: | |
create-release-branch: | |
if: github.event_name == 'workflow_dispatch' | |
name: "Create and PR Release Branch" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set Git config | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "actions@github.com" | |
- name: Check if release branch exists | |
id: check-branch | |
run: | | |
release_branch="release/${{ github.event.inputs.version }}" | |
if git ls-remote --heads origin $release_branch; then | |
echo "branch_exists=true" >> $GITHUB_ENV | |
else | |
echo "branch_exists=false" >> $GITHUB_ENV | |
fi | |
- name: Create or switch to release branch | |
run: | | |
release_branch="release/${{ github.event.inputs.version }}" | |
git checkout -b $release_branch | |
git push --set-upstream origin $release_branch | |
- name: Bump version in package.json | |
run: yarn version --new-version ${{ github.event.inputs.version }} --no-git-tag-version | |
- name: Commit manifest files | |
id: make-commit | |
run: | | |
git add . | |
git commit --message "Prepare release ${{ github.event.inputs.version }}" | |
echo "::set-output name=commit::$(git rev-parse HEAD)" | |
- name: Push new branch | |
run: git push origin release/${{ github.event.inputs.version }} | |
- name: Create PR to master | |
uses: thomaseizinger/create-pull-request@1.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
head: release/${{ github.event.inputs.version }} | |
base: master | |
title: Release version ${{ github.event.inputs.version }} to master | |
reviewers: ${{ github.actor }} | |
body: | | |
Hi @${{ github.actor }}! | |
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. | |
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. | |
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build. | |
- name: Create PR to develop | |
uses: thomaseizinger/create-pull-request@1.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
head: release/${{ github.event.inputs.version }} | |
base: develop | |
title: Release version ${{ github.event.inputs.version }} to develop | |
reviewers: ${{ github.actor }} | |
body: | | |
Hi @${{ github.actor }}! | |
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. | |
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. | |
Merging this PR will update the develop branch with the release changes. | |
# publish-new-release: | |
# if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' | |
# name: "Publish new release" | |
# runs-on: ubuntu-latest | |
# steps: | |
# - 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/create-release@1.0.0 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# target_commitish: ${{ github.event.pull_request.merge_commit_sha }} | |
# tag_name: ${{ env.RELEASE_VERSION }} | |
# name: ${{ env.RELEASE_VERSION }} | |
# draft: false | |
# prerelease: false |