Skip to content

Build and Push Docker Image on Release #2

Build and Push Docker Image on Release

Build and Push Docker Image on Release #2

name: Build and Push Docker Image on Release
on:
release:
types: [published]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract release tag
id: extract_release
run: echo "RELEASE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ github.repository_owner }}/valo-spectra-server:latest
${{ github.repository_owner }}/valo-spectra-server:${{ env.RELEASE_TAG }}