Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD: adding workflow to create container image when tagging #16

Merged
merged 1 commit into from
May 8, 2024
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
35 changes: 35 additions & 0 deletions .github/workflows/build_tagged_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build-tagged-container

on:
push:
tags:
- '*'
env:
REGISTRY: ghcr.io

jobs:
build-tagged-container:
runs-on: ubuntu-latest
steps:
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
# Optionally strip `v` prefix
strip_v: true
- name: Checkout Code
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.prod
push: true # Will only build if this is not here
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{steps.tag.outputs.tag}}
secrets: |
"BRANCH_NAME=${{ github.head_ref || github.ref_name }}"