diff --git a/.github/workflows/gcc-docker.yml b/.github/workflows/gcc-docker.yml deleted file mode 100644 index 5fe4b3f9..00000000 --- a/.github/workflows/gcc-docker.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: gcc-docker -concurrency: - group: ${{ github.ref }}-docker - cancel-in-progress: true -env: - REGISTRY_IMAGE: ghcr.io/${{ github.actor }}/sgdk-m68k-gcc - DOCKERFILE: deps/gcc.Dockerfile - -on: - workflow_dispatch: - push: - paths: - - deps/gcc.Dockerfile - -jobs: - build: - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - strategy: - fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/arm64 - steps: - - name: Checkout - uses: actions/checkout@v3.5.3 - - - name: Docker meta - id: meta_dogecoin - uses: docker/metadata-action@v4.6.0 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - type=raw,latest - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2.2.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.9.1 - - - name: Login to GHCR - if: github.event_name != 'pull_request' - uses: docker/login-action@v2.2.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push by digest - id: build - uses: docker/build-push-action@v4.1.1 - with: - file: ${{ env.DOCKERFILE }} - context: . - platforms: ${{ matrix.platform }} - labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - - - name: Export digest - run: | - mkdir -p /tmp/digests - digest="${{ steps.build.outputs.digest }}" - touch "/tmp/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v3 - with: - name: digests - path: /tmp/digests/* - if-no-files-found: error - retention-days: 1 - - merge: - if: ${{ github.event_name != 'pull_request' }} - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - needs: - - build - steps: - - name: Download digests - uses: actions/download-artifact@v3.0.2 - with: - name: digests - path: /tmp/digests - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.9.1 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4.6.0 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - type=raw,latest - - - name: Login to GHCR - uses: docker/login-action@v2.2.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create manifest list and push - working-directory: /tmp/digests - run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - - - name: Inspect image - run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} - diff --git a/.github/workflows/sgdk-docker.yml b/.github/workflows/sgdk-docker.yml index 6df2c0f6..0723f092 100644 --- a/.github/workflows/sgdk-docker.yml +++ b/.github/workflows/sgdk-docker.yml @@ -1,154 +1,65 @@ name: sgdk-docker concurrency: - group: ${{ github.ref }}-docker - cancel-in-progress: false - -env: - REGISTRY_IMAGE: ghcr.io/${{ github.actor }}/sgdk - BASE_IMAGE: ghcr.io/${{ github.actor }}/sgdk-m68k-gcc - DOCKERFILE: Dockerfile + group: ${{ github.ref }}-sgdk-docker + cancel-in-progress: true on: - workflow_dispatch: - workflow_run: - workflows: [ "gcc-docker" ] + workflow_dispatch: # Allows for manual triggering. + pull_request: # Trigger for pull requests. + types: [opened, synchronize, reopened, ready_for_review] + branches: + - master + push: # Trigger when pushed to master. branches: - - '*' - types: - - completed - push: + - 'master' paths-ignore: - '.github/**' - - 'deployment/**' - - 'doc/**' - 'vstudio/**' - 'bin/**' - 'sample/**' - '**.md' - branches: - - '*' - tags: - - 'v*' - jobs: build: runs-on: ubuntu-latest + permissions: packages: write contents: read - strategy: - fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/arm64 + steps: - name: Checkout - uses: actions/checkout@v3.5.3 - - - name: Docker meta - id: meta_dogecoin - uses: docker/metadata-action@v4.6.0 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - type=raw,latest + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2.2.0 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.9.1 + uses: docker/setup-buildx-action@v3 - - name: Login to GHCR - if: github.event_name != 'pull_request' + - name: Login to GHCR (push events only) + if: github.event_name == 'push' uses: docker/login-action@v2.2.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push by digest - id: build - uses: docker/build-push-action@v4.1.1 - with: - file: ${{ env.DOCKERFILE }} - context: . - build-args: | - BASE_IMAGE=${{ env.BASE_IMAGE }} - platforms: ${{ matrix.platform }} - labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - - - name: Export digest - run: | - mkdir -p /tmp/digests - digest="${{ steps.build.outputs.digest }}" - touch "/tmp/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v3 - with: - name: digests - path: /tmp/digests/* - if-no-files-found: error - retention-days: 1 - - merge: - if: ${{ github.event_name != 'pull_request' }} - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - needs: - - build - steps: - - name: Download digests - uses: actions/download-artifact@v3.0.2 - with: - name: digests - path: /tmp/digests - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.9.1 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4.6.0 + - name: Build (and maybe push) m68k GCC + uses: docker/build-push-action@v5 with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - type=raw,latest - - - name: Login to GHCR - uses: docker/login-action@v2.2.0 + file: deps/gcc.Dockerfile + context: deps/ + platforms: linux/amd64,linux/arm64 + tags: ghcr.io/${{ github.actor }}/sgdk-m68k-gcc:latest + push: ${{ github.event_name == 'push' }} + + - name: Build (any maybe push) SGDK + uses: docker/build-push-action@v5 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create manifest list and push - working-directory: /tmp/digests - run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - - - name: Inspect image - run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + file: Dockerfile + context: . + platforms: linux/amd64,linux/arm64 + tags: ghcr.io/${{ github.actor }}/sgdk:latest + push: ${{ github.event_name == 'push' }} diff --git a/Dockerfile b/Dockerfile index 5228da21..63c46603 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG ALPINE_VERSION=3.18.3 ARG JDK_VER=11 ARG BASE_IMAGE=ghcr.io/stephane-d/sgdk-m68k-gcc -ARG BASE_IMAGE_VERSION=v1.9.0 +ARG BASE_IMAGE_VERSION=latest # Stage Zero - just init image to download files in other stages FROM $BASE_IMAGE:$BASE_IMAGE_VERSION as m68k-files diff --git a/readme.md b/readme.md index c555e486..23871599 100644 --- a/readme.md +++ b/readme.md @@ -120,7 +120,7 @@ To download the `sgdk` base image: Or build it: - docker build -t ghcr.io/stephane-d/sgdk-m68k-gcc:v1.90 -f deps/gcc.Dockerfile deps/ + docker build -t ghcr.io/stephane-d/sgdk-m68k-gcc:latest -f deps/gcc.Dockerfile deps/ docker build -t sgdk . And then to compile the local env, such as `samples` for example: