Rework Github Actions #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Push Docker Image to GitHub | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
COMMIT_SHA: ${{ github.sha }} | |
jobs: | |
build_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for the Docker image | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
latest | |
${{ env.COMMIT_SHA }} | |
${{ vars.DEVELOP_TAG}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./app | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.COMMIT_SHA }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
BUILD_TAG=${{ vars.DEVELOP_TAG }} |