Skip to content

Commit

Permalink
try to move release notes to higher depth checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
acalcutt committed Jan 3, 2024
1 parent 028dbb0 commit 5b6dbeb
Showing 1 changed file with 66 additions and 23 deletions.
89 changes: 66 additions & 23 deletions .github/workflows/node-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,73 @@ jobs:
outputs:
published: ${{ steps.check.outputs.published }}

github_release:
name: Create Github Release with Notes
needs: release-github
if: ${{ needs.release-check.outputs.published == 'false' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Use Node.js from nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Get version
id: package-version
uses: martinbeentjes/[email protected]

- name: npm ci
run: npm ci --ignore-scripts

- name: Prepare release
id: prepare_release
run: |
RELEASE_TYPE="$(node -e "console.log(require('semver').prerelease('${{ steps.package-version.outputs.current-version }}') ? 'prerelease' : 'regular')")"
echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
- name: Build Release Notes
id: release_notes
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }}
run: |
RELEASE_NOTES_PATH="${PWD}/release_notes.txt"
./scripts/release-notes-node.js > ${RELEASE_NOTES_PATH}
echo "release_notes=${RELEASE_NOTES_PATH}" >> $GITHUB_OUTPUT
- name: Create GitHub Release (regular)
id: create_regular_release
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }}
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: node_v${{ steps.package-version.outputs.current-version }}
name: node_v${{ steps.package-version.outputs.current-version }}
bodyFile: ${{ steps.release_notes.outputs.release_notes }}
allowUpdates: true
draft: false
prerelease: false

- name: Create GitHub Release (prerelease)
id: create_prerelease
if: ${{ steps.prepare_release.outputs.release_type == 'prerelease' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: node_v${{ steps.package-version.outputs.current-version }}
name: node_v${{ steps.package-version.outputs.current-version }}
draft: false
prerelease: true

publish_binaries:
needs: release-check
needs: [release-check, release-github]
if: ${{ needs.release-check.outputs.published == 'false' }}
runs-on: ${{ matrix.runs-on }}
strategy:
Expand Down Expand Up @@ -266,28 +331,6 @@ jobs:
RELEASE_TYPE="$(node -e "console.log(require('semver').prerelease('${{ steps.package-version.outputs.current-version }}') ? 'prerelease' : 'regular')")"
echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
- name: Build Release Notes
id: release_notes
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }}
run: |
RELEASE_NOTES_PATH="${PWD}/release_notes.txt"
./scripts/release-notes-node.js > ${RELEASE_NOTES_PATH}
echo "release_notes=${RELEASE_NOTES_PATH}" >> $GITHUB_OUTPUT
- name: Update Release Notes (release)
id: create_regular_release
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }}
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: node_v${{ steps.package-version.outputs.current-version }}
name: node_v${{ steps.package-version.outputs.current-version }}
bodyFile: ${{ steps.release_notes.outputs.release_notes }}
allowUpdates: true
draft: false
prerelease: false

- name: Publish to NPM (release)
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }}
run: |
Expand Down

0 comments on commit 5b6dbeb

Please sign in to comment.