|
16 | 16 | config: |
17 | 17 | - target: aarch64-unknown-linux-musl |
18 | 18 | install-path: /bin/wit-deps |
19 | | - test-bin: nix shell --inputs-from . 'nixpkgs#qemu' -c qemu-aarch64 ./result/bin/wit-deps --version |
| 19 | + test-bin: | |
| 20 | + nix profile install --inputs-from . 'nixpkgs-unstable#qemu' |
| 21 | + qemu-aarch64 ./result/bin/wit-deps --version |
20 | 22 | test-oci: docker load < ./result |
21 | 23 | # TODO: Run aarch64 binary within OCI |
22 | 24 |
|
|
27 | 29 |
|
28 | 30 | - target: armv7-unknown-linux-musleabihf |
29 | 31 | install-path: /bin/wit-deps |
30 | | - test-bin: nix shell --inputs-from . 'nixpkgs#qemu' -c qemu-arm ./result/bin/wit-deps --version |
| 32 | + test-bin: | |
| 33 | + nix profile install --inputs-from . 'nixpkgs-unstable#qemu' |
| 34 | + qemu-arm ./result/bin/wit-deps --version |
31 | 35 | test-oci: docker load < ./result |
32 | 36 | # TODO: Run armv7 binary within OCI |
33 | 37 |
|
|
38 | 42 |
|
39 | 43 | - target: x86_64-pc-windows-gnu |
40 | 44 | install-path: /bin/wit-deps.exe |
41 | | - test-bin: nix shell --inputs-from . 'nixpkgs#wine64' -c wine64 ./result/bin/wit-deps.exe --version |
| 45 | + test-bin: | |
| 46 | + nix profile install --inputs-from . 'nixpkgs-unstable#wine64' |
| 47 | + wine64 ./result/bin/wit-deps.exe --version |
42 | 48 | test-oci: docker load < ./result |
43 | 49 | # TODO: Run windows binary within OCI |
44 | 50 |
|
@@ -146,30 +152,78 @@ jobs: |
146 | 152 | id: deployment |
147 | 153 |
|
148 | 154 | oci: |
149 | | - runs-on: ubuntu-22.04 |
| 155 | + runs-on: ubuntu-24.04 |
150 | 156 | if: ${{ github.event_name != 'pull_request' }} |
151 | 157 | needs: build-bin |
152 | 158 | permissions: |
153 | 159 | packages: write |
154 | 160 | steps: |
155 | | - - uses: actions/checkout@v5 |
| 161 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
156 | 162 | - uses: ./.github/actions/install-nix |
157 | 163 | with: |
158 | 164 | cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' |
159 | | - - uses: docker/login-action@v3 |
| 165 | + |
| 166 | + - name: Extract tag context |
| 167 | + id: ctx |
| 168 | + run: | |
| 169 | + echo "owner=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_OUTPUT" |
| 170 | + echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" |
| 171 | +
|
| 172 | + version=${GITHUB_REF_NAME#v} |
| 173 | + echo "version=${version}" >> "$GITHUB_OUTPUT" |
| 174 | + echo "version is ${version}" |
| 175 | + if [[ $version == *"-"* ]]; then |
| 176 | + echo "version ${version} is a pre-release" |
| 177 | + echo "prerelease=true" >> "$GITHUB_OUTPUT" |
| 178 | + fi |
| 179 | +
|
| 180 | + - name: Login to GitHub Container Registry |
| 181 | + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 |
160 | 182 | with: |
161 | 183 | registry: ghcr.io |
162 | 184 | username: ${{ github.repository_owner }} |
163 | 185 | password: ${{ secrets.GITHUB_TOKEN }} |
164 | | - - run: | |
165 | | - nix run -L .#build-wit-deps-oci wit-deps |
166 | | - nix profile install --inputs-from . 'nixpkgs#buildah' |
167 | | - buildah manifest push --all --format 'v2s2' wit-deps docker://ghcr.io/${{ github.repository_owner }}/wit-deps:${{ github.sha }} |
168 | | - docker run ghcr.io/${{ github.repository_owner }}/wit-deps:${{ github.sha }} wit-deps --version |
| 186 | + |
| 187 | + - name: Install `skopeo` |
| 188 | + run: nix profile install --inputs-from . 'nixpkgs-unstable#skopeo' |
| 189 | + |
| 190 | + - name: Build image |
| 191 | + run: nix build -L .#wit-deps-oci |
| 192 | + |
| 193 | + - name: Test image |
| 194 | + run: | |
| 195 | + skopeo copy oci-archive:./result docker-daemon:wit-deps:test |
| 196 | + docker run --rm wit-deps:test wit-deps --version |
| 197 | +
|
| 198 | + - name: Push commit rev tag |
| 199 | + if: startswith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' |
| 200 | + run: | |
| 201 | + skopeo copy --all oci-archive:./result docker://ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:${{ github.sha }} |
| 202 | + skopeo copy --all oci-archive:./result docker://ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:${{ steps.ctx.outputs.sha_short }} |
| 203 | +
|
| 204 | + docker run --rm ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:${{ github.sha }} wit-deps --version |
| 205 | + docker run --rm ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:${{ steps.ctx.outputs.sha_short }} wit-deps --version |
| 206 | +
|
| 207 | + - name: Push version tag |
| 208 | + if: startswith(github.ref, 'refs/tags/v') |
| 209 | + run: | |
| 210 | + skopeo copy --all oci-archive:./result docker://ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:${{ steps.ctx.outputs.version }} |
| 211 | + docker run --rm ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:${{ steps.ctx.outputs.version }} wit-deps --version |
| 212 | +
|
| 213 | + - name: Push `latest` tag |
| 214 | + if: startswith(github.ref, 'refs/tags/v') && !steps.ctx.outputs.prerelease |
| 215 | + run: | |
| 216 | + skopeo copy --all oci-archive:./result docker://ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:latest |
| 217 | + docker run --rm ghcr.io/${{ steps.ctx.outputs.owner }}/wit-deps:latest wit-deps --version |
169 | 218 |
|
170 | 219 | release: |
171 | | - if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' |
172 | | - needs: [ build-bin, build-lipo, build-doc, cargo ] |
| 220 | + if: startsWith(github.ref, 'refs/tags/v') |
| 221 | + needs: |
| 222 | + - build-bin |
| 223 | + - build-doc |
| 224 | + - build-lipo |
| 225 | + - cargo |
| 226 | + - oci |
173 | 227 | runs-on: ubuntu-24.04 |
174 | 228 | permissions: |
175 | 229 | contents: write |
@@ -218,7 +272,7 @@ jobs: |
218 | 272 | with: |
219 | 273 | name: wit-deps-x86_64-unknown-linux-musl-oci |
220 | 274 |
|
221 | | - - uses: softprops/action-gh-release@v2 |
| 275 | + - uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1 |
222 | 276 | with: |
223 | 277 | draft: true |
224 | 278 | prerelease: true |
|
0 commit comments