Skip to content

Commit 17b2147

Browse files
feat: release binaries (#105)
* feat: release binaries * chore: fix package versions and add token (#107) * chore: set draft to true while still wip * chore: fix package versions * chore: add github token to publish step * chore: debug publish ci step * chore: add more debugging * chore: revert to hd-* for upload artifact * chore: try different token for npm publish * chore: add missing registry-url * chore: moar debug * chore: add missing --no-xz to win build * chore: fix files glob in final step --------- Co-authored-by: Edward Ezekiel <[email protected]>
1 parent 376650b commit 17b2147

File tree

14 files changed

+11573
-206
lines changed

14 files changed

+11573
-206
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

+102-22
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,125 @@
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 }}
1915
steps:
20-
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
21-
id: release
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
17+
- name: Check version changes
18+
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425
19+
id: version
2220
with:
23-
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
24-
config-file: release-please-config.json
25-
manifest-file: .release-please-manifest.json
21+
diff-search: true
22+
file-name: package.json
2623

27-
release:
28-
needs: release-please
29-
if: ${{ needs.release-please.outputs.release_created }}
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 }}
42+
steps:
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
47+
with:
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
68+
- name: Debug Oclif output
69+
shell: bash
70+
run: |
71+
ls -lah packages/cli-${{ matrix.code-target }}/dist
72+
- name: Upload CLI artifact
73+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
74+
with:
75+
name: cli-${{ matrix.code-target }}
76+
path: ./packages/cli-${{ matrix.code-target }}/dist/hd-*
77+
if-no-files-found: error
78+
publish-cli:
79+
name: Publish
3080
runs-on: ubuntu-latest
81+
needs:
82+
- build
3183
permissions:
3284
contents: write
3385
id-token: write
3486
steps:
3587
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
88+
- name: Install Node.js
89+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
3790
with:
3891
node-version-file: '.nvmrc'
3992
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
93+
- name: Create artifacts folder if it doesn't exist
94+
run: mkdir -p artifacts
95+
- name: Download CLI artifacts
96+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
97+
with:
98+
pattern: cli-*
99+
merge-multiple: true
100+
path: artifacts
101+
- name: Debug artifact paths
102+
run: ls -lah artifacts/
103+
- name: Publish npm packages as latest # remove dry-run when ready
104+
run: |
105+
ls -lah artifacts/ # Debug output
106+
for artifact in artifacts/*; do
107+
echo "$artifact"
108+
npm publish "./$artifact" --tag latest --access public --provenance --dry-run
109+
done
44110
env:
45-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
111+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
- name: Debug artifacts before release
113+
run: ls -lah artifacts/
114+
- name: Create GitHub release and tag
115+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
with:
119+
name: CLI v${{ needs.check.outputs.version }}
120+
tag_name: cli/v${{ needs.check.outputs.version }}
121+
draft: true # Keep as a draft during dry run
122+
files: |
123+
artifacts/*.tar.gz
124+
fail_on_unmatched_files: true
125+
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)