Skip to content

Commit

Permalink
ci: more permissions and env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
jmesserli authored Jan 22, 2024
1 parent 612f5aa commit 47bab40
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:

build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
Expand Down Expand Up @@ -41,18 +43,27 @@ jobs:
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Docker Metadata action
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.run_number }}
type=raw,value=latest
type=sha
- name: Build Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
tags: |
ghcr.io/${{ github.repository }}:${{ github.run_number }}
ghcr.io/${{ github.repository }}:latest
tags: ${{ steps.meta.output.tags }}
labels: ${{ steps.meta.output.labels }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

0 comments on commit 47bab40

Please sign in to comment.