Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: release binaries #105

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: CI

on:
pull_request:
workflow_dispatch:
# pull_request: temporary exclude

jobs:
commit-lint:
Expand Down
124 changes: 102 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,125 @@
name: release
on:
push:
branches:
- main
pull_request: # remove me when ready
workflow_dispatch:

permissions:
contents: read

jobs:
release-please:
check:
name: Check version
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
permissions:
contents: write
pull-requests: write
version: ${{ steps.version.outputs.version }}
steps:
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
id: release
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Check version changes
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425
id: version
with:
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
diff-search: true
file-name: package.json

release:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
build:
strategy:
matrix:
include:
- os: windows-2022
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: macos-14
target: aarch64-apple-darwin
code-target: darwin-arm64
name: Package ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
needs: check
env:
version: ${{ needs.check.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version-file: '.nvmrc'
- name: Install linux toolchain
if: matrix.code-target == 'linux-x64'
run: |
sudo apt install nsis p7zip-full p7zip-rar -y
- name: Install win32 toolchain
if: matrix.code-target == 'win32-x64'
run: |
choco install 7zip nsis grep -y
echo "C:\Program Files (x86)\GnuWin32\bin" >> $GITHUB_PATH
- name: Install npm dependencies
run: npm ci
- name: Build javascript
run: npm run build
- name: Build binaries
shell: bash
run: |
cd packages/cli-${{ matrix.code-target }}
npm ci
npm run pack
- name: Debug Oclif output
shell: bash
run: |
ls -lah packages/cli-${{ matrix.code-target }}/dist
- name: Upload CLI artifact
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: cli-${{ matrix.code-target }}
path: ./packages/cli-${{ matrix.code-target }}/dist/hd-*
if-no-files-found: error
publish-cli:
name: Publish
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
- name: Install Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build
- name: Create NPM release
run: npm publish --provenance --access public
- name: Create artifacts folder if it doesn't exist
run: mkdir -p artifacts
- name: Download CLI artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
with:
pattern: cli-*
merge-multiple: true
path: artifacts
- name: Debug artifact paths
run: ls -lah artifacts/
- name: Publish npm packages as latest # remove dry-run when ready
run: |
ls -lah artifacts/ # Debug output
for artifact in artifacts/*; do
echo "$artifact"
npm publish "./$artifact" --tag latest --access public --provenance --dry-run
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug artifacts before release
run: ls -lah artifacts/
- name: Create GitHub release and tag
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: CLI v${{ needs.check.outputs.version }}
tag_name: cli/v${{ needs.check.outputs.version }}
draft: true # Keep as a draft during dry run
files: |
artifacts/*.tar.gz
fail_on_unmatched_files: true
generate_release_notes: true
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
*-error.log
**/.DS_Store
/.idea
/dist
/tmp
dist
tmp
node_modules
oclif.manifest.json

yarn.lock
pnpm-lock.yaml

**/packages/cli-*/bin/
**/tsconfig.tsbuildinfo

# cli-generated files
nes.**.**
3 changes: 0 additions & 3 deletions .release-please-manifest.json

This file was deleted.

Loading