Skip to content

chore(release): 4.1.1 #12

chore(release): 4.1.1

chore(release): 4.1.1 #12

Workflow file for this run

name: CI/CD Build Image [Master/Beta]
on:
push:
tags:
- "v*.*.*"
- "v*.*.*-beta.*"
permissions:
packages: write
contents: write
env:
GHCR_REGISTRY: ghcr.io
DH_REGISTRY: docker.io
IMAGE_NAME: wizarrrr/wizarr
# IMAGE_TAG: beta
jobs:
before_build:
name: Prepare for Build
runs-on: ubuntu-latest
steps:
# Clear the digests from the artifacts
- name: Clear digests
uses: geekyeggo/delete-artifact@v2
with:
name: |
digests_dh
digests_ghcr
build:
name: Build Digest for Registry
runs-on: ubuntu-latest
needs:
- before_build
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
# Use NPM and Node.js to install dependencies
- name: Use Node.js 18.18.2
uses: actions/setup-node@v4
with:
node-version: 18.18.2
# Set up Python and install Poetry
- uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install Poetry
- name: Install Poetry
run: |
pip install poetry==1.6.1
poetry config virtualenvs.create false
# Install dependencies
- name: Install dependencies
run: npm install
# Build the Repository
- name: Build the Repository
run: |
npx nx build wizarr-backend
npx nx build wizarr-frontend
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login to GHCR
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push the image
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/wizarr-ci/Dockerfile
push: true
platforms: ${{ matrix.platform }}
provenance: false
outputs: type=image,name=${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true
# Export the digest for later use
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
# Upload the digest as an artifact
- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests_ghcr
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Merge Digest to Registry
runs-on: ubuntu-latest
needs:
- build
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
# Check if the tag is a beta tag
- name: Get Release Branch
id: release-branch
run: |
if [[ ${{ github.ref }} == 'refs/tags/v'*.*.*-beta.* ]]; then
echo "::set-output name=release_branch::beta"
elif [[ ${{ github.ref }} == 'refs/tags/v'*.*.* ]]; then
echo "::set-output name=release_branch::latest"
else
echo "Unknown tag, not setting environment variable."
exit 1
fi
# Download the digests from the artifacts
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests_ghcr
path: /tmp/digests
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login to GHCR
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.DH_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Get the tag name
- name: Get tag name
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
# Create manifest list and push
- name: Create manifest list and push to Registry
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
--tag ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.release-branch.outputs.release_branch }} \
--tag ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} \
--tag ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.release-branch.outputs.release_branch }} \
--tag ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# Inspect image
- name: Inspect image
run: docker buildx imagetools inspect ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.release-branch.outputs.release_branch }}