Draft release #10
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: Draft release | |
on: | |
workflow_dispatch: | |
inputs: | |
semver_release_type: | |
description: SemVer Level for this Release | |
required: true | |
default: patch | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- name: Bump and commit new version | |
id: bump_version | |
run: | | |
git config --global user.email "<>" | |
git config --global user.name "NJWDS Draft Release Action" | |
NEW_VERSION=$(npm version ${{ inputs.semver_release_type }} --no-git-tag-version) | |
BRANCH_NAME=upgrade-package-$NEW_VERSION | |
git checkout -b $BRANCH_NAME | |
git add package.json package-lock.json | |
git commit -m "Bump version to $NEW_VERSION" | |
git push -u origin $BRANCH_NAME | |
gh pr create -B main -H $BRANCH_NAME --title "Upgrade NWJDS package version to $NEW_VERSION" --body "Created by Github Action" | |
RELEASE_SHA=$(git rev-parse HEAD) | |
echo ::set-output name=new_version::$NEW_VERSION | |
echo ::set-output name=release_sha::$RELEASE_SHA | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
new_version: ${{ steps.bump_version.outputs.new_version }} | |
release_sha: ${{ steps.bump_version.outputs.release_sha }} | |
draft-release: | |
needs: update-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.update-version.outputs.release_sha }} | |
- run: | | |
gh release create ${{ needs.update-version.outputs.new_version }} \ | |
--draft \ | |
--generate-notes \ | |
--target ${{ needs.update-version.outputs.release_sha }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |