Skip to content

Commit

Permalink
update GHA workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rpardini committed Jan 1, 2023
1 parent a0a8682 commit 8409484
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions .github/workflows/master-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,22 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

# We use buildx instead of regular build so we can take advantage of Docker layer cache via GithubActions' cache
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

# Setup the Github Actions cache.
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildxarch-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildxarch-
uses: docker/setup-buildx-action@v2

- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }} # github username or org
password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access.

- name: Prepare
id: prep
run: |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
username: ${{ github.repository_owner }} # GitHub username or org
password: ${{ secrets.GITHUB_TOKEN }} # GitHub actions builtin token. repo has to have pkg access.

- name: Build and push
id: docker_build
Expand All @@ -48,16 +34,16 @@ jobs:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
pull: true
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest,ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
cache-from: type=local,src=/tmp/.buildx-cache/release
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/release
cache-from: type=gha # all-automatic GitHub Actions caching
cache-to: type=gha,mode=max

0 comments on commit 8409484

Please sign in to comment.