|
1 | 1 | name: release
|
2 | 2 | on:
|
3 |
| - push: |
4 |
| - branches: |
5 |
| - - main |
| 3 | + pull_request: # remove me when ready |
6 | 4 | workflow_dispatch:
|
7 | 5 |
|
8 | 6 | permissions:
|
9 | 7 | contents: read
|
10 | 8 |
|
11 | 9 | jobs:
|
12 |
| - release-please: |
| 10 | + check: |
| 11 | + name: Check version |
13 | 12 | runs-on: ubuntu-latest
|
14 | 13 | 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 }} |
19 | 42 | 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 |
22 | 47 | 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 |
26 | 68 |
|
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 |
30 | 77 | runs-on: ubuntu-latest
|
| 78 | + needs: |
| 79 | + - build |
31 | 80 | permissions:
|
32 | 81 | contents: write
|
33 | 82 | id-token: write
|
34 | 83 | steps:
|
35 | 84 | - 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 |
37 | 87 | with:
|
38 | 88 | 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 |
44 | 103 | 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 |
0 commit comments