oops #60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Argon server | |
| # needed to push to ghcr | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths-ignore: | |
| - '**.md' | |
| - 'rustfmt.toml' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - 'LICENSE' | |
| jobs: | |
| linux: | |
| name: Linux (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| arch: amd64 | |
| - platform: linux/arm64 | |
| arch: arm64 | |
| steps: | |
| - name: Prepare | |
| run: | | |
| platform=${{ matrix.platform }} | |
| echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
| echo "GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.GHCR_IMAGE }} | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| cache-from: type=gha,scope=argon-server-linux-${{ matrix.arch }} | |
| cache-to: type=gha,mode=max,compression=zstd,compression-level=8,scope=argon-server-linux-${{ matrix.arch }} | |
| outputs: | | |
| type=image,push-by-digest=true,name-canonical=true,push=true | |
| type=local,dest=out | |
| target: runtime-debian | |
| platforms: ${{ matrix.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ env.GHCR_IMAGE }} | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| - name: Export digest | |
| run: | | |
| mkdir -p ${{ runner.temp }}/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-${{ env.PLATFORM_PAIR }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| - name: Prepare artifacts | |
| run: | | |
| mkdir -p artifacts | |
| if [ "${{ matrix.arch }}" = "amd64" ]; then | |
| cp out/argon-server artifacts/argon-server-x64 | |
| cp out/argon-node artifacts/argon-node-x64 | |
| else | |
| cp out/argon-server artifacts/argon-server-arm64 | |
| cp out/argon-node artifacts/argon-node-arm64 | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-${{ matrix.arch }} | |
| path: artifacts/* | |
| windows: | |
| name: Windows | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: nightly-2026-05-01 | |
| target: x86_64-pc-windows-msvc | |
| - name: Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: | | |
| cargo build --release --features all,mimalloc --target x86_64-pc-windows-msvc | |
| env: | |
| SERVER_SHARED_PREBUILT_DATA: 1 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: target/x86_64-pc-windows-msvc/release/*.exe | |
| merge: | |
| name: Merge artifacts and digests | |
| runs-on: ubuntu-latest | |
| needs: [linux, windows] | |
| steps: | |
| - name: Convert repository to lowercase | |
| run: | | |
| echo "GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV | |
| - name: Download digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Set up buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.GHCR_IMAGE }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Create manifest list and push | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(printf '${{ env.GHCR_IMAGE }}@sha256:%s ' *) | |
| - name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect ${{ env.GHCR_IMAGE }}:${{ steps.meta.outputs.version }} | |
| - name: Merge server binaries | |
| uses: actions/upload-artifact/merge@v4 | |
| with: | |
| name: argon-server-build | |
| delete-merged: true | |
| pattern: '!digests-*' | |
| - name: Delete digests | |
| uses: GeekyEggo/delete-artifact@v5.1.0 | |
| with: | |
| name: 'digests-*' |