-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (124 loc) · 5.2 KB
/
Copy pathncc-release.yaml
File metadata and controls
152 lines (124 loc) · 5.2 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: flatlock-release
run-name: >
(#${{ github.run_number }}) flatlock release ${{ github.ref_name }}
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
permissions: {}
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x64
- os: ubuntu-24.04-arm
platform: linux
arch: arm64
- os: macos-15
platform: darwin
arch: arm64
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build standalone binary
run: |
chmod +x ./bin/ncc.sh
pnpm run build:ncc
- name: Rename binaries with platform suffix
run: |
mv ncc/flatlock ncc/flatlock-${{ matrix.platform }}-${{ matrix.arch }}
mv ncc/flatcover ncc/flatcover-${{ matrix.platform }}-${{ matrix.arch }}
- name: Upload flatlock artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: flatlock-${{ matrix.platform }}-${{ matrix.arch }}
path: ncc/flatlock-${{ matrix.platform }}-${{ matrix.arch }}
- name: Upload flatcover artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: flatcover-${{ matrix.platform }}-${{ matrix.arch }}
path: ncc/flatcover-${{ matrix.platform }}-${{ matrix.arch }}
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Download all artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: binaries
merge-multiple: true
- name: Make binaries executable
run: chmod +x binaries/*
- name: Create GitHub Release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
tag_name: ${{ github.ref_name }}
name: flatlock ${{ github.ref_name }}
generate_release_notes: true
files: |
binaries/flatlock-linux-x64
binaries/flatlock-linux-arm64
binaries/flatlock-darwin-arm64
binaries/flatcover-linux-x64
binaries/flatcover-linux-arm64
binaries/flatcover-darwin-arm64
body: |
## flatlock ${{ github.ref_name }}
The Matlock of lockfile parsers - extracts packages without building dependency graphs.
### Binaries
| Binary | Description |
|--------|-------------|
| `flatlock` | Extract packages from lockfiles |
| `flatcover` | Check package coverage against a registry |
### Installation
Download the appropriate binary for your platform and add it to your PATH:
```bash
# Linux (x64)
curl -L -o flatlock https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/flatlock-linux-x64
curl -L -o flatcover https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/flatcover-linux-x64
chmod +x flatlock flatcover
mv flatlock flatcover /usr/local/bin/
# Linux (ARM64)
curl -L -o flatlock https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/flatlock-linux-arm64
curl -L -o flatcover https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/flatcover-linux-arm64
chmod +x flatlock flatcover
mv flatlock flatcover /usr/local/bin/
# macOS (Apple Silicon)
curl -L -o flatlock https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/flatlock-darwin-arm64
curl -L -o flatcover https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/flatcover-darwin-arm64
chmod +x flatlock flatcover
mv flatlock flatcover /usr/local/bin/
```
### Usage
```bash
# Extract packages from lockfile
flatlock package-lock.json
flatlock pnpm-lock.yaml --specs --json
# Check coverage against a registry
flatcover pnpm-lock.yaml --cover --summary
flatcover pnpm-lock.yaml --cover --registry https://npm.pkg.github.com --token ghp_xxx
```
See the [README](https://github.com/${{ github.repository }}#readme) for full documentation.