Skip to content

Commit

Permalink
Merge pull request #72 from Starfly-13/publish-docker-to-ghcr
Browse files Browse the repository at this point in the history
Publish Docker Images to GitHub Container Registry
  • Loading branch information
blinkdog authored Jun 22, 2024
2 parents 517e5f7 + 64b2709 commit c993903
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
build_linux:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
name: "Build (Linux)"
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
test_windows:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
name: "Build (Windows)"
runs-on: windows-latest
steps:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/publish_ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
publish:
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
name: "Publish to GitHub Container Registry"
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3

- 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/starfly-13
# 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@v4
with:
context: .
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
File renamed without changes.

0 comments on commit c993903

Please sign in to comment.