Skip to content

Update build.yml for master #5

Update build.yml for master

Update build.yml for master #5

Workflow file for this run

name: Update gh docker image and triggers
on:
# Triggers the workflow on releases
push:
branches:
- master
tags:
- '*'
workflow_dispatch:
jobs:
build-image:
name: Build docker image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the image id
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_ENV"
- name: Get the version PR
run: echo "VERSION=${{ github.head_ref }}" >> "$GITHUB_ENV"
if: github.event_name == 'pull_request'
- name: Get the version
run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
if: github.event_name != 'pull_request'
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }}
platforms: linux/amd64,linux/arm64