-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (74 loc) · 2.32 KB
/
build-publish-drunk.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This is a basic workflow to help you get started with Actions
name: build-publish
on:
push:
branches: ['main']
#paths:
# - src/**
env:
Enable_Release: 'true'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Versioning
- uses: rmeneely/git-next-version@v1
with:
tag_pattern: 'v[0-9]*.[0-9]*.[0-9]*'
increment: 'patch'
auto_increment: 'true'
remove_prefix: 'true'
- name: Print the version
run: |
echo ${{ env.NEXT_VERSION }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'
- run: npm install --force
# - name: Run Lints
# continue-on-error: true
# run: npm run lint
- name: Build and Pack
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
npm run build
- name: Update version in package.json
run: |
cd .out-bin
sed -i 's/"version": "0.0.1"/"version": "${{ env.NEXT_VERSION }}"/' package.json
# Create Release
- name: Create Release
id: create_release
if: ${{ env.Enable_Release == 'true' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.NEXT_VERSION }}
release_name: Release v${{ env.NEXT_VERSION }}
draft: false
prerelease: false
- name: Publish to npm
if: ${{ env.Enable_Release == 'true' }}
run: |
cd .out-bin
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "@drunk-pulumi"
npm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}