Skip to content

Commit

Permalink
Merge pull request #30 from civts/master
Browse files Browse the repository at this point in the history
Add gh action to build and publish image on tag 🏷️
  • Loading branch information
NetBender committed May 6, 2024
2 parents 18f7c87 + 5a88782 commit 70da213
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ghcr_on_tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Push Docker Image

permissions:
contents: read
packages: write

on:
push:
tags:
- "*"

jobs:
build-and-push:
runs-on: ubuntu-latest

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

- name: Build docker image
run: docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} .

- name: Push Docker image to ghcr
run: |
# Log in to GitHub Container Registry and push the image
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin && \
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}

0 comments on commit 70da213

Please sign in to comment.