Draft Release #11
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: | |
TAG_NAME: | |
description: 'Tag name that the release will created with' | |
required: true | |
env: | |
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} | |
permissions: | |
contents: write | |
jobs: | |
draft: | |
name: Draft Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check package.json version with tag | |
run: | | |
PKG_VERSION=`cat package.json | jq -r .version` | |
if [ "${PKG_VERSION}" != "${{ env.TAG_NAME }}" ]; then | |
echo "package.json version does not match tag name" | |
exit 1 | |
fi | |
# Release build | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'package-lock.json' | |
- run: npm ci | |
- run: npm run release | |
# validate committed release | |
- name: Diff fresh build with committed bundle | |
run: | | |
git add --renormalize dist/index.js | |
git diff --exit-code --name-status | |
- name: Draft Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
name: v${{ env.TAG_NAME }} | |
tag_name: ${{ env.TAG_NAME }} | |
fail_on_unmatched_files: true | |
generate_release_notes: true |