-
Notifications
You must be signed in to change notification settings - Fork 4
37 lines (35 loc) · 1.18 KB
/
cicd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: CI/CD
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and test
run: |
yarn
yarn run build
yarn run codegen
- id: version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "::set-output name=version::${GITHUB_REF##refs/tags/v}"
- name: Publish NPM package
if: startsWith(github.ref, 'refs/tags/v')
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
run: |
npm version --no-git-tag-version "${{steps.version.outputs.version}}"
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
npm publish --access public
rm .npmrc
- name: Github Release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: v${{steps.version.outputs.version}}
release_name: v${{steps.version.outputs.version}}
body: |
## NPM Package
https://www.npmjs.com/package/graphql-codegen-golang/v/$${{steps.version.outputs.version}}