Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Added github action to push to ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroZanatta committed Jul 15, 2024
1 parent 47699a0 commit 19ec593
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
name: build
---
name: Build and push docker image

on:
push:
branches:
- main
tags:
- v*
pull_request:
branches: [main]

env:
REGISTRY: registry.snakectf.org
TAG: latest

jobs:
build:
build-and-push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/[email protected]
with:
image: tonistiigi/binfmt:qemu-v6.2.0
platforms: arm64
- uses: docker/[email protected]
with:
driver-opts: image=moby/buildkit
- uses: docker/[email protected]
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha,format=long
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: docker/[email protected]
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/[email protected]

- name: Build and push image
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}/management-2024/jail:${{ env.TAG }}
platforms: linux/amd64,linux/arm64
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 19ec593

Please sign in to comment.