|
1 | 1 | # Creates and publishes assets for a new release. |
2 | | -# To manually trigger this workflow, create a release in the GitHub UI. |
3 | | - |
4 | 2 | name: Publish |
5 | 3 |
|
6 | 4 | on: |
7 | | - # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release |
8 | 5 | release: |
9 | 6 | types: |
10 | | - - created |
11 | | - # workflow_dispatch is just for testing, and it won't fully work. |
| 7 | + - created # triggered by Bump Version creating a release |
12 | 8 | workflow_dispatch: |
13 | | - inputs: |
14 | | - name: |
15 | | - description: fake version name |
16 | | - required: true |
17 | | - |
18 | | -env: |
19 | | - # hack to get dynlibs working with musl |
20 | | - # https://github.com/rust-lang/rust/pull/55163#issuecomment-436631090 |
21 | | - RUSTFLAGS: -C target-feature=-crt-static |
22 | 9 |
|
23 | 10 | jobs: |
24 | 11 | publish-github: |
@@ -72,97 +59,50 @@ jobs: |
72 | 59 | PRE_GYP_ARCH: ${{ matrix.system.pre_gyp_arch }} |
73 | 60 | CARGO_BUILD_TARGET: ${{ matrix.system.target }} |
74 | 61 | run: | |
75 | | - node publish.js |
| 62 | + node build.js |
76 | 63 | cd bin-package |
77 | 64 | echo "asset=$(echo *.tar.gz)" >> "$GITHUB_OUTPUT" |
78 | 65 | - name: Upload release asset |
79 | 66 | run: gh release upload ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} bin-package/${{ steps.build.outputs.asset }} --clobber |
80 | 67 | env: |
81 | 68 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
82 | 69 |
|
83 | | - # The # WORKAROUND below doesn't work anymore, actions are forced to use a node20 runtime that doesn't work on alpine |
84 | | - # publish-github-docker: |
85 | | - # runs-on: ${{ matrix.os }} |
86 | | - # container: |
87 | | - # image: node:${{ matrix.node_version }}-alpine |
88 | | - # strategy: |
89 | | - # fail-fast: false |
90 | | - # matrix: |
91 | | - # node_version: |
92 | | - # - 20 |
93 | | - # - 22 |
94 | | - # - 24 |
95 | | - # os: |
96 | | - # - ubuntu-24.04 |
97 | | - # - ubuntu-24.04-arm |
98 | | - # steps: |
99 | | - # - run: apk add build-base git python3 wget github-cli |
100 | | - # # WORKAROUND |
101 | | - # # https://github.com/actions/runner/issues/801#issuecomment-1374967227 |
102 | | - # - run: | |
103 | | - # apk add gcompat |
104 | | - # sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release |
105 | | - # - uses: actions/checkout@v4 |
106 | | - # with: |
107 | | - # ref: ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} |
108 | | - # - uses: c-hive/gha-yarn-cache@v2 |
109 | | - # - uses: actions-rs/toolchain@v1 |
110 | | - # with: |
111 | | - # profile: minimal |
112 | | - # toolchain: stable |
113 | | - # override: true |
114 | | - # - name: Install modules |
115 | | - # run: yarn install --ignore-scripts |
116 | | - # - name: Build |
117 | | - # id: build |
118 | | - # run: | |
119 | | - # node publish.js |
120 | | - # cd bin-package |
121 | | - # echo "asset=$(echo *.tar.gz)" >> "$GITHUB_OUTPUT" |
122 | | - # - name: Upload release asset |
123 | | - # run: | |
124 | | - # git config --global --add safe.directory $(pwd) |
125 | | - # gh release upload ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} bin-package/${{ steps.build.outputs.asset }} --clobber |
126 | | - # env: |
127 | | - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + # Release musl binaries |
| 71 | + publish-github-docker: |
| 72 | + runs-on: ${{ matrix.os }} |
| 73 | + strategy: |
| 74 | + matrix: |
| 75 | + # These Node versions should match those above in the `publish-github` job. |
| 76 | + node_version: |
| 77 | + - 20 |
| 78 | + - 22 |
| 79 | + - 24 |
| 80 | + os: |
| 81 | + - ubuntu-24.04 |
| 82 | + - ubuntu-24.04-arm |
| 83 | + fail-fast: false |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v5 |
| 86 | + - name: Build |
| 87 | + id: build |
| 88 | + run: docker build --build-arg NODE_VERSION=${{matrix.node_version}} --output type=local,dest=./host-artifacts . |
| 89 | + - name: Output |
| 90 | + run: | |
| 91 | + cd host-artifacts/out |
| 92 | + echo "asset=$(echo *.tar.gz)" >> "$GITHUB_OUTPUT" |
| 93 | + - name: Upload release asset |
| 94 | + run: | |
| 95 | + git config --global --add safe.directory $(pwd) |
| 96 | + gh release upload ${{ github.event.release.tag_name }}${{ github.event.inputs.name }} host-artifacts/out/${{ steps.build.outputs.asset }} --clobber |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
128 | 99 |
|
129 | 100 | publish-npm: |
130 | | - if: "${{ github.event.release.tag_name }}" |
131 | 101 | needs: |
132 | 102 | - publish-github |
133 | | - # - publish-github-docker |
134 | | - runs-on: ubuntu-24.04 |
135 | | - steps: |
136 | | - - uses: actions/checkout@v5 |
137 | | - with: |
138 | | - ref: ${{ github.event.release.tag_name }} |
139 | | - - uses: actions/setup-node@v4 |
140 | | - with: |
141 | | - node-version: 24 |
142 | | - cache: yarn |
143 | | - - uses: actions-rs/toolchain@v1 |
144 | | - with: |
145 | | - profile: minimal |
146 | | - toolchain: stable |
147 | | - override: true |
148 | | - - name: Install modules |
149 | | - run: yarn install --ignore-scripts |
150 | | - - run: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN |
151 | | - env: |
152 | | - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
153 | | - - name: Publish NPM release |
154 | | - run: | |
155 | | - set -x |
156 | | - # If it's not a simple 1.2.3 version, then it's a prerelease of some kind. |
157 | | - if [[ ${{ github.event.release.tag_name }} =~ .*-.* ]] ; then |
158 | | - PRE="--prerelease" |
159 | | - fi |
160 | | - node publish.js --publish "${PRE}" |
161 | | - - name: Finalize GitHub release |
162 | | - uses: ncipollo/release-action@v1 |
163 | | - with: |
164 | | - token: ${{ secrets.WORKFLOW_PAT }} |
165 | | - prerelease: ${{ contains(github.event.release.name, '-') }} |
166 | | - allowUpdates: true |
167 | | - tag: ${{ github.event.release.tag_name }} |
168 | | - name: ${{ github.event.release.name }} |
| 103 | + - publish-github-docker |
| 104 | + uses: IronCoreLabs/workflows/.github/workflows/typescript-release.yaml@typescript-release-v1 |
| 105 | + with: |
| 106 | + pre_publish_steps: "./build.js" |
| 107 | + publish_working_directory: "dist" |
| 108 | + secrets: inherit |
0 commit comments