Skip to content

Commit

Permalink
Only run publish on main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHZhang committed Oct 23, 2020
1 parent 90788e6 commit d6bfee6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ on:
push:
tags:
- "v*" # Trigger the workflow on push tag events matching glob (e.g. v1.0, v20.15.10)
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# "ref" specifies the branch to check out.
# "github.event.release.target_commitish" specifies the target branch of the release.
ref: ${{ github.event.release.target_commitish }}

# with:
# # "ref" specifies the branch to check out.
# # "github.event.release.target_commitish" specifies the target branch of the release.
# ref: ${{ github.event.release.target_commitish }}
- name: Create release
id: create_release
uses: actions/create-release@v1
Expand All @@ -42,22 +44,20 @@ jobs:
yarn build
yarn test
- name: Setup git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Upgrade version in package.json to release tag version
run: yarn version ${{ github.event.release.tag_name }}

- name: Publish to NPM via auth token
run: yarn publish
run: yarn publish --tag ${{ github.event.release.target_commitish }}
env:
# Ensure NPM_TOKEN is added to repository secrets.
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push version changes
run: git push
- name: Config git and push version changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git push
env:
# GITHUB_TOKEN is automatically provided by actions.
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ With ES module `import` syntax:

```typescript
import cookiePlugin from 'fastify-cookie';
// Default import...
import csrfPlugin from 'fastify-xsurf';
// ... or named import
import {csrfPlugin} from 'fastify-xsurf';

fastify.register(cookiePlugin);
fastify.register(csrfPlugin, {
Expand Down

0 comments on commit d6bfee6

Please sign in to comment.