-
Notifications
You must be signed in to change notification settings - Fork 25
57 lines (55 loc) · 1.79 KB
/
release-snapshot.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
name: Release a snapshot
on:
# Only manual workflow trigger
workflow_dispatch:
inputs:
includeNext:
description: 'include "next" version of contracts'
default: 'true'
type: boolean
jobs:
release-snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.0.0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Cache NPM dependencies
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Set relevant environment variables
run: |
if [[ ${{ github.event.inputs.includeNext }} == 'true' ]]; then
echo "COLONY_CONTRACTOR_INCLUDE_NEXT=true" >> $GITHUB_ENV
fi
- name: Create .npmrc (to be logged in for publishing)
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm run bootstrap
- run: pnpm run lint
- run: pnpm run build
env:
NODE_OPTIONS: --max-old-space-size=4096
- run: pnpm run test
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
- name: Generate git hash of current HEAD
run: echo "VERSION_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Version snapshot
run: npx changeset version --snapshot snapshot-${{ env.VERSION_HASH }} && pnpm install --lockfile-only
- name: Publish snapshot to npm
run: npx changeset publish --snapshot --tag snapshot --no-git-tag