Skip to content

Commit

Permalink
ci: add publish action (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Papooch committed Mar 23, 2023
1 parent ac6b72a commit 0a7f6c4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/publish-to-npm.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish to NPM

on:
workflow_dispatch:
inputs:
version:
description: The version string passed to "npm version". Either `patch`, `minor`, `major` or a semver like `1.2.3`
required: true
type: string

permissions:
contents: write

concurrency:
cancel-in-progress: true
group: publish-${{ github.ref }}

jobs:
publish_to_npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
- uses: actions/setup-node@v2
with:
node-version: 16.x
registry-url: "https://registry.npmjs.org"
cache: npm

- name: Configure git
run: |
git config --local user.name 'github-action[bot]'
git config --local user.email 'github-action[bot]@github.com'
- run: npm ci --audit=false
- run: npm run build

- run: npm version ${{ inputs.version }}

- name: Push to git
run: |
git push
git push --tags
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "v$(npm -s run env echo '$npm_package_version')"

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ gqlschema.gql
**/*.spec.js
**/*.js.map

.eslinrc.js
.eslintrc.js
.prettierrc
nest-cli.json
tsconfig.tsbuildinfo
tsconfig.json
tsconfig.build.json
.dependency-cruiser.js
dependency-graph.html
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add [no ci] to version commits so it does not trigger pipelines
message="%s [no ci]"

0 comments on commit 0a7f6c4

Please sign in to comment.