From b827a2f3428e24ce77ec48e824844299e185e539 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sat, 18 Dec 2021 00:31:03 +0800 Subject: docker: upgrade base images to `alpine3.14` (#6675) --- .github/workflows/docker.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to '.github/workflows/docker.yml') diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 19dc08aa..8406e713 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,10 +13,16 @@ jobs: buildx: runs-on: ubuntu-latest steps: + - name: Canel previous runs on main + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + uses: styfle/cancel-workflow-action@0.9.1 + with: + all_but_latest: true + access_token: ${{ secrets.GITHUB_TOKEN }} - name: Checkout code uses: actions/checkout@v2 - name: Set up QEMU - id: qemu + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx @@ -32,14 +38,7 @@ jobs: echo "Status: ${{ steps.buildx.outputs.status }}" echo "Flags: ${{ steps.buildx.outputs.flags }}" echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - - name: Build images on pull requests - if: ${{ github.event_name == 'pull_request' }} - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64,linux/arm/v7 - name: Login to Docker Hub - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -51,7 +50,18 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push images on commits to main + - name: Get short commit SHA + uses: benjlevesque/short-sha@v1.2 + - name: Build and push images on pull requests + if: ${{ github.event_name == 'pull_request' }} + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64 + push: true + tags: | + gogs/gogs:commit-${{ env.SHA }} + - name: Build and push images on main if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} uses: docker/build-push-action@v2 with: -- cgit v1.2.3