Skip to content

Commit

Permalink
edits for #229, build image for PRs from forks?
Browse files Browse the repository at this point in the history
  • Loading branch information
vogler committed Nov 7, 2023
1 parent 5fda138 commit 584130f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ on:
- "v*"
tags:
- "v*"
pull_request:
paths:
- '**'
- '!README.md'
- '!.github/**'
pull_request: # runs when opened/reopned or when the head branch is updated, see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
branches:
- "main"
- "main" # only PRs against main

jobs:
docker:
Expand Down Expand Up @@ -39,7 +43,7 @@ jobs:
-
name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' # TODO if DOCKERHUB_* are set?
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -48,22 +52,23 @@ jobs:
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
username: ${{ github.actor }} # actor is user that opened PR, was repository_owner before
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
if: github.event_name != 'pull_request'
# if: github.event_name != 'pull_request' # still want to build image
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' }} # TODO push for forks?
build-args: |
COMMIT=${{ github.sha }}
BRANCH=${{ env.BRANCH }}
NOW=${{ env.NOW }}
platforms: linux/amd64,linux/arm64 # ,linux/arm/v7
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/free-games-claimer:${{env.IMAGE_TAG}}
${{ secrets.DOCKERHUB_USERNAME }}/free-games-claimer:${{env.IMAGE_TAG}} # TODO if DOCKERHUB_* are set?
ghcr.io/${{ github.actor }}/free-games-claimer:${{env.IMAGE_TAG}}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 584130f

Please sign in to comment.