Skip to content

Data Security Service - Version 1.0.0 #2

Data Security Service - Version 1.0.0

Data Security Service - Version 1.0.0 #2

name: Build and push Docker image to GitHub Packages
# Trigger the workflow on release creation for the main branch:
on:
release:
types: [released]
jobs:
docker_image_build_and_push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Checkout the repository:
- name: Checkout code
uses: actions/checkout@v4
# Log in to GitHub Docker Registry (GitHub Packages):
- name: Log in to GitHub Docker Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Build the Docker image:
- name: Build Docker image
run: docker build -t ghcr.io/${{ github.repository }}:latest .
# Push the Docker image to GitHub Packages:
- name: Push Docker image to GitHub Packages
run: docker push ghcr.io/${{ github.repository }}:latest
# Tag the Docker image with the release version:
- name: Tag the Docker image with the release version
run: docker tag ghcr.io/${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
# Push the Docker image with the release version to GitHub Packages:
- name: Push the Docker image with the release version to GitHub Packages
run: docker push ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}