-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (58 loc) · 1.67 KB
/
generator-hasura-ndc-nodejs-lambda.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: "generator-hasura-ndc-nodejs-lambda npm package"
on:
pull_request:
branches:
- main
- test-ci/**
push:
branches:
- 'main'
- test-ci/**
tags:
- v**
defaults:
run:
working-directory: ./yeoman-generator
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
cache: npm
cache-dependency-path: ./yeoman-generator/package-lock.json
- run: npm ci
- run: npm run build
publish:
needs: build
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
cache: npm
cache-dependency-path: ./yeoman-generator/package-lock.json
- run: |
PACKAGE_VERSION=`npm version | sed -rn "2 s/.*: '([^']*)'.*/\1/g; 2 p"`
TAG=`echo "$GITHUB_REF"| sed -r "s#.*/##g"`
echo '$TAG' = "$TAG"
echo '$GITHUB_REF' = "$GITHUB_REF"
echo '$PACKAGE_VERSION' = "$PACKAGE_VERSION"
if [ "$TAG" = "v$PACKAGE_VERSION" ]
then
echo "Success! Versions match."
else
echo "Package version (v$PACKAGE_VERSION) must match tag (GITHUB_REF: $GITHUB_REF) in order to publish" 1>&2
exit 1
fi
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}