-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (54 loc) · 1.54 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
60
61
name: CI/CD
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- README.md
- .gitignore
- .prettierignore
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install & Build & Test
run: |
corepack enable
pnpm install --frozen-lockfile
pnpm run build
pnpm run gen:rickandmorty
pnpm run test:rickandmorty
pnpm run gen:anilist
- 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')
working-directory: packages/graphql-codegen-golang
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm version --no-git-tag-version '${{ steps.version.outputs.version }}'
npm publish
- name: Github Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
body: |
## NPM Package
https://www.npmjs.com/package/graphql-codegen-golang/v/${{ steps.version.outputs.version }}