Skip to content

Commit 70b220c

Browse files
feat: release binaries
1 parent 8f6f47a commit 70b220c

15 files changed

+11569
-211
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: CI
22

33
on:
4-
pull_request:
4+
workflow_dispatch:
5+
# pull_request: temporary exclude
56

67
jobs:
78
commit-lint:

.github/workflows/release.yml

+94-23
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,116 @@
11
name: release
22
on:
3-
push:
4-
branches:
5-
- main
3+
pull_request: # remove me when ready
64
workflow_dispatch:
75

86
permissions:
97
contents: read
108

119
jobs:
12-
release-please:
10+
check:
11+
name: Check version
1312
runs-on: ubuntu-latest
1413
outputs:
15-
release_created: ${{ steps.release.outputs.release_created }}
16-
permissions:
17-
contents: write
18-
pull-requests: write
14+
version: ${{ steps.version.outputs.version }}
15+
steps:
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
17+
- name: Check version changes
18+
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425
19+
id: version
20+
with:
21+
diff-search: true
22+
file-name: package.json
23+
24+
build:
25+
strategy:
26+
matrix:
27+
include:
28+
- os: windows-2022
29+
target: x86_64-pc-windows-msvc
30+
code-target: win32-x64
31+
- os: ubuntu-20.04
32+
target: x86_64-unknown-linux-gnu
33+
code-target: linux-x64
34+
- os: macos-14
35+
target: aarch64-apple-darwin
36+
code-target: darwin-arm64
37+
name: Package ${{ matrix.code-target }}
38+
runs-on: ${{ matrix.os }}
39+
needs: check
40+
env:
41+
version: ${{ needs.check.outputs.version }}
1942
steps:
20-
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
21-
id: release
43+
- name: Checkout repository
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
- name: Install Node.js
46+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
2247
with:
23-
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
24-
config-file: release-please-config.json
25-
manifest-file: .release-please-manifest.json
48+
node-version-file: '.nvmrc'
49+
- name: Install linux toolchain
50+
if: matrix.code-target == 'linux-x64'
51+
run: |
52+
sudo apt install nsis p7zip-full p7zip-rar -y
53+
- name: Install win32 toolchain
54+
if: matrix.code-target == 'win32-x64'
55+
run: |
56+
choco install 7zip nsis grep -y
57+
echo "C:\Program Files (x86)\GnuWin32\bin" >> $GITHUB_PATH
58+
- name: Install npm dependencies
59+
run: npm ci
60+
- name: Build javascript
61+
run: npm run build
62+
- name: Build binaries
63+
shell: bash
64+
run: |
65+
cd packages/cli-${{ matrix.code-target }}
66+
npm ci
67+
npm run pack
2668
27-
release:
28-
needs: release-please
29-
if: ${{ needs.release-please.outputs.release_created }}
69+
- name: Upload CLI artifact
70+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
71+
with:
72+
name: cli-${{ matrix.code-target }}
73+
path: ./packages/cli-${{ matrix.code-target }}/dist/hd-*
74+
if-no-files-found: error
75+
publish-cli:
76+
name: Publish
3077
runs-on: ubuntu-latest
78+
needs:
79+
- build
3180
permissions:
3281
contents: write
3382
id-token: write
3483
steps:
3584
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
85+
- name: Install Node.js
86+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
3787
with:
3888
node-version-file: '.nvmrc'
39-
registry-url: 'https://registry.npmjs.org'
40-
- run: npm install
41-
- run: npm run build
42-
- name: Create NPM release
43-
run: npm publish --provenance --access public
89+
- name: Create artifacts folder if it doesn't exist
90+
run: mkdir -p artifacts
91+
- name: Download CLI artifacts
92+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
93+
with:
94+
pattern: cli-*
95+
merge-multiple: true
96+
path: artifacts
97+
- name: Publish npm packages as latest # remove dry-run when ready
98+
run: |
99+
for artifact in artifacts/*; do
100+
echo "$artifact"
101+
npm publish "$artifact" --tag latest --access public --provenance --dry-run
102+
done
44103
env:
45-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
104+
NODE_AUTH_TOKEN: ${{ secrets.HD_CLI_NPM_TOKEN }}
105+
- name: Create GitHub release and tag
106+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
with:
110+
name: CLI v${{ needs.check.outputs.version }}
111+
tag_name: cli/v${{ needs.check.outputs.version }}
112+
draft: false
113+
files: |
114+
artifacts/cli-*
115+
fail_on_unmatched_files: true
116+
generate_release_notes: true

.gitignore

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
*-error.log
33
**/.DS_Store
44
/.idea
5-
/dist
6-
/tmp
5+
dist
6+
tmp
77
node_modules
88
oclif.manifest.json
9-
109
yarn.lock
1110
pnpm-lock.yaml
12-
11+
**/packages/cli-*/bin/
1312
**/tsconfig.tsbuildinfo
14-
15-
# cli-generated files
1613
nes.**.**

.release-please-manifest.json

-3
This file was deleted.

0 commit comments

Comments
 (0)