From f1f82e96a5535a510ddcacd5a54da2b6fe924d4e Mon Sep 17 00:00:00 2001 From: Pierce Trey Date: Mon, 12 Jul 2021 16:10:51 -0600 Subject: [PATCH] use docker Build & Push action --- .github/dependabot.yml | 7 ++++ .github/workflows/release-build-publish.yaml | 44 ++++++++++---------- 2 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2c7d170 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/release-build-publish.yaml b/.github/workflows/release-build-publish.yaml index 592c41a..b21d0c1 100644 --- a/.github/workflows/release-build-publish.yaml +++ b/.github/workflows/release-build-publish.yaml @@ -79,6 +79,19 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/p8e-ui + + DOCKER_TAGS=$IMAGE_ID:$VERSION + + PRERELEASE=${{ github.event.release.prerelease }} + echo PRERELEASE=$PRERELEASE + + if [ "$PRERELEASE" == "false" ]; then + DOCKER_TAGS=$DOCKER_TAGS,$IMAGE_ID:latest + fi + + echo "DOCKER_TAGS=$DOCKER_TAGS" >> $GITHUB_ENV + - name: Download Artifact uses: actions/download-artifact@v2 with: @@ -101,9 +114,6 @@ jobs: - name: Available platforms run: echo ${{ steps.qemu.outputs.platforms }} - - name: Build image - run: docker build . --file docker/Dockerfile --tag "p8e-ui:$VERSION" --load - - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: @@ -111,23 +121,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} - - name: Push image - run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/p8e-ui - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker tag "p8e-ui:$VERSION" $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - - PRERELEASE=${{ github.event.release.prerelease }} - echo PRERELEASE=$PRERELEASE - - if [ "$PRERELEASE" == "false" ]; then - docker tag "p8e-ui:$VERSION" $IMAGE_ID:latest - docker push $IMAGE_ID:latest - fi \ No newline at end of file + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.DOCKER_TAGS }} \ No newline at end of file