This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
forked from redpwn/jail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github action to push to ghcr.io
- Loading branch information
1 parent
47699a0
commit 19ec593
Showing
1 changed file
with
30 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |