Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github actions: don't attempt to push docker image from forks #21

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/docker-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
if: github.repository == 'shaarli/Shaarli'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: github.repository == 'shaarli/Shaarli'
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand All @@ -34,12 +36,13 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
push: true
push: ${{ github.repository == 'shaarli/Shaarli' }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
${{ secrets.DOCKER_IMAGE }}:latest
ghcr.io/${{ secrets.DOCKER_IMAGE }}:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Run trivy scanner on latest docker image
if: github.repository == 'shaarli/Shaarli'
run: make test_trivy_docker TRIVY_TARGET_DOCKER_IMAGE=ghcr.io/${{ secrets.DOCKER_IMAGE }}:latest
7 changes: 4 additions & 3 deletions .github/workflows/docker-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
if: github.repository == 'shaarli/Shaarli'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
- name: Login to GitHub Container Registry
if: github.repository == 'shaarli/Shaarli'
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand All @@ -34,7 +35,7 @@ jobs:
id: docker_build
uses: docker/build-push-action@v3
with:
push: true
push: ${{ github.repository == 'shaarli/Shaarli' }}
platforms: linux/amd64,linux/arm/v7
tags: |
${{ secrets.DOCKER_IMAGE }}:${{ env.REF }}
Expand Down
Loading