Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/publish_ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# publish_ghcr.yml
name: Publish

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
publish:
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
name: "Publish to GitHub Container Registry"
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Enable Docker Cache
uses: ScribeMD/docker-cache@0.5.0
with:
key: docker-${{ runner.os }}-${{ hashFiles('dependencies.sh') }}

- name: Checkout Project
uses: actions/checkout@v6

- name: Docker Meta
id: docker_meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/starfly-13/sf13
# add git short SHA as Docker tag
tags: |
# branch event
type=ref,event=branch
# pull request event
type=ref,event=pr
# full length sha
type=sha,format=long

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Docker Image
uses: docker/build-push-action@v6
with:
context: .
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
Loading