diff --git a/.github/workflows/ghcr-image.yml b/.github/workflows/ghcr-image.yml index a5e8322..92d05d3 100644 --- a/.github/workflows/ghcr-image.yml +++ b/.github/workflows/ghcr-image.yml @@ -1,44 +1,56 @@ name: Docker Image Build Push + on: push: tags: - "*" + concurrency: group: "docker-image" cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout + - + name: Checkout uses: actions/checkout@v3 - - name: Set up QEMU + - + name: Set up QEMU uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx + - + name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Generate repository name run: | echo "REPOSITORY_PATH=$( echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' )" >> ${GITHUB_ENV} echo "REPOSITORY_SHA=$( echo ${GITHUB_SHA} | cut -c 1-8 )" >> ${GITHUB_ENV} - - name: Login to GitHub Container Registry + - + name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and Push + - + name: Build and Push uses: docker/build-push-action@v3 with: context: . file: ./prod/Dockerfile platforms: linux/amd64,linux/arm64 push: true - build-args: "VERSION=${{ github.ref_name }}\nCARGO_INCREMENTAL=0 \n" + build-args: | + VERSION=${{ github.ref_name }} + CARGO_INCREMENTAL=0 tags: | ghcr.io/${{ env.REPOSITORY_PATH }}:v${{ github.ref_name }} ghcr.io/${{ env.REPOSITORY_PATH }}:${{ env.REPOSITORY_SHA }} ghcr.io/${{ env.REPOSITORY_PATH }}:latest - - name: GitHub Release + - + name: GitHub Release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prod-ci-image.yml b/.github/workflows/prod-ci-image.yml index d3b2d4a..16027cb 100644 --- a/.github/workflows/prod-ci-image.yml +++ b/.github/workflows/prod-ci-image.yml @@ -1,4 +1,5 @@ name: Build Prod Image CI + on: workflow_dispatch: pull_request: @@ -7,23 +8,28 @@ on: push: branches: - "*" + jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout + - + name: Checkout uses: actions/checkout@v3 - - name: Set up QEMU + - + name: Set up QEMU uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx + - + name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build Prod Image CI uses: docker/build-push-action@v3 with: context: . - file: prod/Dockerfile + file: prod/Dockerfile platforms: linux/amd64 push: false build-args: | VERSION=latest CARGO_INCREMENTAL=0 +