diff --git a/.github/workflows/docker-alpha.yml b/.github/workflows/docker-alpha.yml index d7ac732..fe3f7c4 100644 --- a/.github/workflows/docker-alpha.yml +++ b/.github/workflows/docker-alpha.yml @@ -1,29 +1,53 @@ name: Update Docker alpha tag on: + push: + branches: ["actions-merge-preview/**"] pull_request: - branches: [ "main" ] + branches: ["actions-merge-preview/**"] -jobs: +env: + APP_NAME: watchlistarr + DOCKER_FILE: docker/Dockerfile + DOCKER_PLATFORMS: "linux/arm64/v8,linux/amd64" - build: +jobs: + build: runs-on: ubuntu-latest - - steps: - uses: actions/checkout@v3 - - name: Set up environment - run: echo "DOCKER_TAG=$(date +%s)" >> $GITHUB_ENV + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build the Docker image - run: docker build . --file docker/Dockerfile --tag nylonee/watchlistarr:${DOCKER_TAG} --label=VERSION=${DOCKER_TAG} - - name: Push Docker image - run: | - docker tag nylonee/watchlistarr:${DOCKER_TAG} nylonee/watchlistarr:alpha - docker push nylonee/watchlistarr:${DOCKER_TAG} - docker push nylonee/watchlistarr:alpha + + - name: Docker Metadata action + id: meta + uses: docker/metadata-action@v4.3.0 + with: + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }} + tags: | + type=sha + alpha + + - name: Docker Setup QEMU + uses: docker/setup-qemu-action@v2.1.0 + + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v2.5.0 + with: + buildkitd-flags: --debug + + - name: Build and push Docker images + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ${{ env.DOCKER_FILE }} + platforms: ${{ env.DOCKER_PLATFORMS }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/docker-beta.yml b/.github/workflows/docker-beta.yml index b63f19a..5836d61 100644 --- a/.github/workflows/docker-beta.yml +++ b/.github/workflows/docker-beta.yml @@ -4,26 +4,47 @@ on: push: branches: [ "main" ] -jobs: +env: + APP_NAME: watchlistarr + DOCKER_FILE: docker/Dockerfile + DOCKER_PLATFORMS: "linux/arm64/v8,linux/amd64" +jobs: build: - runs-on: ubuntu-latest - - steps: - uses: actions/checkout@v3 - - name: Set up environment - run: echo "DOCKER_TAG=$(date +%s)" >> $GITHUB_ENV + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build the Docker image - run: docker build . --file docker/Dockerfile --tag nylonee/watchlistarr:${DOCKER_TAG} --label=VERSION=${DOCKER_TAG} - - name: Push Docker image - run: | - docker tag nylonee/watchlistarr:${DOCKER_TAG} nylonee/watchlistarr:beta - docker push nylonee/watchlistarr:${DOCKER_TAG} - docker push nylonee/watchlistarr:beta + + - name: Docker Metadata action + id: meta + uses: docker/metadata-action@v4.3.0 + with: + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }} + tags: | + type=sha + beta + + - name: Docker Setup QEMU + uses: docker/setup-qemu-action@v2.1.0 + + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v2.5.0 + with: + buildkitd-flags: --debug + + - name: Build and push Docker images + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ${{ env.DOCKER_FILE }} + platforms: ${{ env.DOCKER_PLATFORMS }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/merge-preview.yml b/.github/workflows/merge-preview.yml index 10b4322..3880d4d 100644 --- a/.github/workflows/merge-preview.yml +++ b/.github/workflows/merge-preview.yml @@ -7,7 +7,7 @@ on: jobs: preview: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: nwtgck/actions-merge-preview@develop diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 8d30086..ca26bc0 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -4,25 +4,50 @@ on: release: types: [published] -jobs: +env: + APP_NAME: watchlistarr + DOCKER_FILE: docker/Dockerfile + DOCKER_PLATFORMS: "linux/arm64/v8,linux/amd64" - build: +jobs: + build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up environment - run: echo "DOCKER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + - uses: actions/checkout@v3 + + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build the Docker image - run: docker build . --file docker/Dockerfile --tag nylonee/watchlistarr:${DOCKER_TAG} --label=VERSION=${DOCKER_TAG} - - name: Push Docker image - run: | - docker tag nylonee/watchlistarr:${DOCKER_TAG} nylonee/watchlistarr:latest - docker push nylonee/watchlistarr:${DOCKER_TAG} - docker push nylonee/watchlistarr:latest + + - name: Docker Metadata action + id: meta + uses: docker/metadata-action@v4.3.0 + with: + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }} + tags: | + type=sha + type=semver,pattern={{version}} + latest + + - name: Docker Setup QEMU + uses: docker/setup-qemu-action@v2.1.0 + + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v2.5.0 + with: + buildkitd-flags: --debug + + - name: Build and push Docker images + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ${{ env.DOCKER_FILE }} + platforms: ${{ env.DOCKER_PLATFORMS }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}