-
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (70 loc) · 2.21 KB
/
autobuild.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
name: Autobuild
on:
push:
branches:
- main
workflow_dispatch:
inputs:
dry_run:
description: "Perform a dry run (no actual publish)"
required: false
type: boolean
default: false
jobs:
autobuild:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: "package.json"
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: "pnpm"
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build package
run: pnpm build
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Update version
run: npm version "0.0.0-alpha-${{ steps.vars.outputs.sha_short }}" --no-git-tag-version
- name: Publish package
run: pnpm publish --no-git-checks --tag alpha ${{ inputs.dry_run && '--dry-run' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup Node with GPR
uses: actions/setup-node@v4
with:
cache: "pnpm"
node-version-file: ".nvmrc"
registry-url: "https://npm.pkg.github.com"
scope: "@grikomsn"
- name: Rename package for GPR
run: node scripts/rename-gpr-package.js
- name: Publish package on GPR
run: pnpm publish --no-git-checks --tag alpha ${{ inputs.dry_run && '--dry-run' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Pack package (dry run)
if: ${{ inputs.dry_run }}
run: |
pnpm pack
mkdir -p artifacts
mv *.tgz artifacts/
- name: Upload artifact (dry run)
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@v4
with:
name: package-artifact
path: artifacts/*.tgz
retention-days: 5