Skip to content

Commit

Permalink
Merge pull request #2 from budimanjojo/main
Browse files Browse the repository at this point in the history
feat: add CI to push container to ghcr
  • Loading branch information
arthurgeek authored Jul 12, 2023
2 parents 64f331c + f128ddc commit 35e15ef
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Publish container

on:
workflow_dispatch: {}
push:
tags:
- "*"
branches:
- main
paths:
- DOCKERFILE
- config/**
- scripts/**

jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Container meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw, value=latest, enable={{is_default_branch}}
type=semver, pattern={{version}}
type=ref, event=branch
type=ref, event=tag
type=ref, event=pr
- name: Build and push to ghcr
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 35e15ef

Please sign in to comment.