diff --git a/workflow.patch b/workflow.patch new file mode 100644 index 0000000..8353c05 --- /dev/null +++ b/workflow.patch @@ -0,0 +1,206 @@ +diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml +index 0000000..0000000 100644 +--- a/.github/workflows/package-release.yml ++++ b/.github/workflows/package-release.yml +@@ -3,13 +3,13 @@ name: Package Release + on: + workflow_call: + + permissions: +- contents: read ++ contents: write + packages: write + + jobs: + package-release: + strategy: + fail-fast: false + matrix: + include: + - name: linux-amd64 + runner: ubuntu-24.04 + platform: linux + arch: amd64 + - name: linux-arm64 + runner: ubuntu-24.04-arm64 + platform: linux + arch: arm64 + runs-on: ${{ matrix.runner }} + env: + BUILD_DIR: build/${{ matrix.platform }}-${{ matrix.arch }} + ZIP_NAME: sdl3_app-${{ matrix.platform }}-${{ matrix.arch }}.zip + PLATFORM_NAME: ${{ matrix.platform }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-${{ matrix.platform }}-${{ matrix.arch }} + path: . +- run-id: ${{ github.run_id }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Package release ZIP + run: python scripts/package_release.py + + - name: Publish GitHub release asset + if: github.ref != 'refs/tags/local' + uses: softprops/action-gh-release@v1 + with: + files: release/${{ env.ZIP_NAME }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml +index 0000000..0000000 100644 +--- a/.github/workflows/publish-container.yml ++++ b/.github/workflows/publish-container.yml +@@ -1,49 +1,60 @@ + name: Publish Container Image + + on: + workflow_call: + + permissions: + contents: read + packages: write + + jobs: + publish-image: + strategy: + fail-fast: false + matrix: + include: + - name: linux-amd64 + platform: linux + arch: amd64 + - name: linux-arm64 + platform: linux + arch: arm64 + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 + ++ - name: Set up Docker Buildx ++ uses: docker/setup-buildx-action@v3 ++ + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + +- - name: Build and publish container image +- run: | +- docker build \ +- --build-arg USERNAME=builder \ +- --build-arg UID=$(id -u) \ +- --build-arg GID=$(id -g) \ +- -f .github/workflows/Dockerfile \ +- -t sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} . +- IMAGE=ghcr.io/${{ github.repository_owner }}/sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} +- docker tag sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} "$IMAGE" +- docker push "$IMAGE" ++ - name: Build and publish container image ++ uses: docker/build-push-action@v5 ++ with: ++ context: . ++ file: .github/workflows/Dockerfile ++ push: true ++ platforms: linux/${{ matrix.arch }} ++ tags: ghcr.io/${{ github.repository_owner }}/sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} ++ build-args: | ++ USERNAME=builder ++ UID=1000 ++ GID=1000 +diff --git a/.github/workflows/upload-build-artifact.yml b/.github/workflows/upload-build-artifact.yml +index 0000000..0000000 100644 +--- a/.github/workflows/upload-build-artifact.yml ++++ b/.github/workflows/upload-build-artifact.yml +@@ -1,63 +1,73 @@ + name: Upload Build Artifacts + + on: + workflow_call: + + permissions: + contents: write + + jobs: + upload-artifact: + strategy: + fail-fast: false + matrix: + include: + - name: linux-amd64 + platform: linux + arch: amd64 + - name: linux-arm64 + platform: linux + arch: arm64 + runs-on: ubuntu-24.04 + env: + BUILD_DIR: build/${{ matrix.platform }}-${{ matrix.arch }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 ++ ++ - name: Set up Docker Buildx ++ uses: docker/setup-buildx-action@v3 + + - name: Build linux container image + if: matrix.platform == 'linux' + run: | +- docker build \ +- --build-arg USERNAME=builder \ +- --build-arg UID=$(id -u) \ +- --build-arg GID=$(id -g) \ +- -f .github/workflows/Dockerfile \ +- -t sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} . ++ docker buildx build \ ++ --platform linux/${{ matrix.arch }} \ ++ --load \ ++ --build-arg USERNAME=builder \ ++ --build-arg UID=$(id -u) \ ++ --build-arg GID=$(id -g) \ ++ -f .github/workflows/Dockerfile \ ++ -t sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} . + + - name: Run linux build in container + if: matrix.platform == 'linux' + env: + BUILD_DIR: ${{ env.BUILD_DIR }} + run: | + docker run --rm \ + -e BUILD_DIR \ + -w /workspace \ + -v "${{ github.workspace }}:/workspace" \ + sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} \ + bash -c 'set -euo pipefail + if [ -d "$BUILD_DIR" ]; then rm -rf "$BUILD_DIR"; fi + cp -a /conan_build "$BUILD_DIR" + cmake -S . -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release + cmake --build "$BUILD_DIR" --config Release' + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.platform }}-${{ matrix.arch }} + path: ${{ env.BUILD_DIR }}