Skip to content

web-frontend-image-build #4

web-frontend-image-build

web-frontend-image-build #4

name: web-frontend-image-build
on:
release:
types: published
env:
REGISTRY: ghcr.io
IMAGE_NAME: k1nd4sus/cerbero-frontend
BUILD_PATH: web/frontend
ARTIFACT_NAME: cerbero-frontend
WORKFLOW: web-frontend-build.yml
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
- arm64
permissions:
actions: read
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get the build
uses: dawidd6/action-download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }} # artifact name
path: ${{ env.BUILD_PATH }}/dist # the artifact is extracted into this directory
workflow: ${{ env.WORKFLOW }}
workflow_conclusion: success
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Podman
run: |
sudo apt-get update
sudo apt-get -y install podman qemu-user-static
- name: Build image
run: |
cd ${{ env.BUILD_PATH }}
podman build -t ${{ matrix.platform }} --arch ${{ matrix.platform }} .
podman save -o ${{ matrix.platform }} ${{ matrix.platform }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.platform }}'
path: ${{ env.BUILD_PATH }}/${{ matrix.platform }}
if-no-files-found: error
retention-days: 1
tag:
needs: build
runs-on: ubuntu-latest
outputs:
release: ${{ steps.determine_tag.outputs.release }}
steps:
- name: Find tag
id: determine_tag
run: |
if [[ ${{ github.event.release.tag_name }} == *"beta"* ]]; then
echo "release=beta" >> "$GITHUB_OUTPUT"
elif [[ ${{ github.event.release.tag_name }} == *"alpha"* ]]; then
echo "release=alpha" >> "$GITHUB_OUTPUT"
else
echo "release=latest" >> "$GITHUB_OUTPUT"
fi
push:
needs: tag
runs-on: ubuntu-latest
strategy:
matrix:
tags:
- ${{ github.event.release.tag_name }}
- ${{ needs.tag.outputs.release }}
steps:
- name: Setup
run: |
sudo apt update
sudo apt-get -y install podman qemu-user-static
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Registry login
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u ${{ github.actor }} --password-stdin ${{ env.REGISTRY }}
- name: Create and push manifest
run: |
podman manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tags }}
podman manifest add ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tags }} docker-archive:amd64
podman manifest add ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tags }} docker-archive:arm64
podman manifest inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tags }}
podman manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tags }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tags }}