Skip to content

Commit

Permalink
chore: publish from ci (#13)
Browse files Browse the repository at this point in the history
- adds release.yml to deploy from ci if tests pass on main and there is
a change to the changelog
- fix bug in build.yml where node version variable name was wrong.
testing was not really done on multiple node versions!

License: MIT

Signed-off-by: Oli Evans <oli@protocol.ai>
  • Loading branch information
olizilla authored May 1, 2023
1 parent a613b45 commit 5df4116
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npm test
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
# run after the "build" workflow
workflow_run:
workflows: [build]
branches: [main]
types:
- completed

name: Release
jobs:
changelog:
# only run if tests succeed.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
release_created: ${{ steps.rp.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: rp
with:
release-type: node
package-name: dagula
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Other Changes","hidden":false}]'

publish:
# only publish if there is a change to the changelog
needs: changelog
if: ${{ needs.changelog.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 comments on commit 5df4116

Please sign in to comment.