Skip to content

Commit

Permalink
fix: gh action for publishing pre-releases (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahradelahi committed Jun 23, 2024
1 parent f0df9fe commit 1990f85
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish Canary Release

on:
push:
tags:
- v*-canary.*

jobs:
create-github-release:
permissions:
contents: write
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Calculate release name
run: |
GITHUB_REF=${{ github.ref }}
RELEASE_NAME=${GITHUB_REF#"refs/tags/"}
echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV
- name: Publish release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: true

publish-npm-release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- run: pnpm install --frozen-lockfile
- run: npm install -g npm@latest
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
if: github.repository == 'shahradelahi/node-vault'
name: Build & Publish Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
},
"private": false,
"publishConfig": {
"access": "public"
"access": "public",
"provenance": true
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 1990f85

Please sign in to comment.