|
| 1 | +name: Build and test |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: w64devkit-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + pull_request: |
| 10 | + branches: [ "master" ] |
| 11 | + |
| 12 | +# Must set Settings -> Actions -> General -> Workflow permissions to |
| 13 | +# "Read and write permissions" |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository |
| 21 | + env: |
| 22 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + arch: ["x64", "x86"] |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v6 |
| 31 | + |
| 32 | + - name: Set up Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v4 |
| 34 | + |
| 35 | + - name: Apply x86 patch |
| 36 | + if: matrix.arch == 'x86' |
| 37 | + run: patch -p1 -i src/variant-x86.patch |
| 38 | + |
| 39 | + - name: Generate archive name and version string |
| 40 | + id: filename |
| 41 | + env: |
| 42 | + ARCH: ${{ matrix.arch }} |
| 43 | + run: | |
| 44 | + GIT_VERSION="$(git describe --tags --always)" |
| 45 | + echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT |
| 46 | + echo "archive=w64devkit-$ARCH-${GIT_VERSION:1}" >> $GITHUB_OUTPUT |
| 47 | +
|
| 48 | + - name: Build image |
| 49 | + uses: docker/build-push-action@v7 |
| 50 | + with: |
| 51 | + context: . |
| 52 | + tags: w64devkit:${{ matrix.arch }} |
| 53 | + load: true |
| 54 | + cache-from: type=gha,scope=w64devkit-${{ matrix.arch }} |
| 55 | + cache-to: type=gha,scope=w64devkit-${{ matrix.arch }},mode=max |
| 56 | + |
| 57 | + - name: Extract artifact |
| 58 | + run: | |
| 59 | + docker run --rm w64devkit:${{ matrix.arch }} > w64devkit.exe |
| 60 | + |
| 61 | + - name: Rename artifact |
| 62 | + run: | |
| 63 | + mv w64devkit.exe ${{ steps.filename.outputs.archive }}.exe |
| 64 | + ls -lh ${{ steps.filename.outputs.archive }}.exe |
| 65 | +
|
| 66 | + - name: Upload artifact |
| 67 | + uses: actions/upload-artifact@v7 |
| 68 | + with: |
| 69 | + name: ${{ steps.filename.outputs.archive }}.exe |
| 70 | + path: ${{ steps.filename.outputs.archive }}.exe |
| 71 | + archive: false |
| 72 | + |
| 73 | + - name: Create Release |
| 74 | + if: startsWith(github.ref, 'refs/tags/') |
| 75 | + uses: softprops/action-gh-release@v2 |
| 76 | + with: |
| 77 | + name: ${{ steps.filename.outputs.version }} |
| 78 | + files: w64devkit-*.exe |
| 79 | + draft: true |
0 commit comments