Skip to content

build-and-push-tag

build-and-push-tag #1

Workflow file for this run

name: build-and-push-tag
on:
push:
tags:
- v*
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo TAG_NAME=$(echo $GITHUB_REF | sed -e "s|refs/tags/||") >> $GITHUB_ENV
- name: Build and push image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/config-reloader:${{ env.TAG_NAME }}