Merge pull request #12 from MarcoBuster/issue-7

Don't try to push images if the event is a pull request
This commit is contained in:
Andrea Cavalli 2020-11-24 15:30:03 +01:00 committed by GitHub
commit 3ff813c6b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,6 +81,7 @@ jobs:
- name: Login to ghcr registry
uses: docker/login-action@v1
if: ${{ ! github.event_name == 'pull_request' }}
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
@ -88,6 +89,7 @@ jobs:
- name: Login to Docker Hub registry
uses: docker/login-action@v1
if: ${{ ! github.event_name == 'pull_request' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
@ -106,6 +108,7 @@ jobs:
tdlightbotapi:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }}
- name: Tag and push image
if: ${{ ! github.event_name == 'pull_request' }}
run: |
docker tag tdlightbotapi:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }} ${{ env.IMAGE_TAG }}:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }}
docker tag tdlightbotapi:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }} ${{ env.IMAGE_TAG }}:${{ env.VERSION }}-${{ env.SAFE_ARCH }}
@ -117,10 +120,17 @@ jobs:
docker push ${{ env.IMAGE_TAG_DH }}:${{ env.VERSION }}-${{ env.SAFE_ARCH }}
- name: Save image as tar archive
if: ${{ ! github.event_name == 'pull_request' }}
run: |
docker image ls # debug
docker save ${{ env.IMAGE_TAG }}:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }} -o ${{ env.SAFE_ARCH }}.tar
- name: Save image as tar archive (pull request)
if: ${{ github.event_name == 'pull_request' }}
run: |
docker image ls # debug
docker save tdlightbotapi:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }} -o ${{ env.SAFE_ARCH }}.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
@ -130,6 +140,7 @@ jobs:
push-manifest:
name: Create and push multi-arch Docker manifest
runs-on: ubuntu-latest
if: ${{ ! github.event_name == 'pull_request' }}
env:
DOCKER_CLI_EXPERIMENTAL: enabled
needs: build