-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(create-release): add release action
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
outputs: | ||
release_created: ${{ steps.rp.outputs.release_created }} | ||
tag_name: ${{ steps.rp.outputs.tag_name }} | ||
upload_url: ${{ steps.rp.outputs.upload_url }} | ||
steps: | ||
- name: Release please | ||
id: rp | ||
uses: googleapis/release-please-action@v4 | ||
with: | ||
release-type: node | ||
|
||
build-publish: | ||
name: Build and publish module | ||
runs-on: ubuntu-latest | ||
needs: release | ||
if: ${{ needs.release.outputs.release_created }} | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build assets | ||
run: npm run build | ||
- name: Determine NPM tag | ||
id: npm-tag | ||
run: echo npm-tag=$(jq -r .version package.json | grep -q 'alpha\|beta\|rc' && echo "next" || echo "latest") >> $GITHUB_OUTPUT | ||
- run: npm publish --provenance --access public --tag ${{ steps.npm-tag.outputs.npm-tag }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |