-
Notifications
You must be signed in to change notification settings - Fork 4
59 lines (52 loc) · 1.73 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI/CD
on:
push:
branches:
- main
paths-ignore:
- README.md
- .gitignore
- .prettierignore
pull_request:
workflow_dispatch:
concurrency:
group: cicd-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
- uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # tag=v3
with:
node-version-file: .nvmrc
- name: Install & Build & Test
run: |
corepack enable
pnpm install --frozen-lockfile --strict-peer-dependencies
pnpm run build
pnpm run gen
- name: Compute package version
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@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # tag=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 }}