Skip to content

v0.7.0

v0.7.0 #96

name: Publish Docker Image
on:
workflow_dispatch:
push:
branches:
- "main"
release:
types: [prereleased,released]
jobs:
build-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: pnpm/[email protected]
with:
version: latest
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: latest
- name: Build
run: |
pnpm install
pnpm build
- name: Upload artifact - web
uses: actions/upload-artifact@v4
with:
name: web
path: dist
publish-docker-image:
runs-on: ubuntu-latest
needs:
- build-web
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Download artifact - web
uses: actions/download-artifact@v4
with:
name: web
path: dist/
- name: Prepare Tag
# Borrowed from daeuniverse/dae
id: prep
env:
REF: ${{ github.ref }}
run: |
DIR="$(pwd)/dist/"
if [ -d "$DIR" ]; then
### Take action if $DIR exists ###
echo "Installing config files in ${DIR}..."
else
### Control will jump here if $DIR does NOT exists ###
echo "Error: ${DIR} not found. Can not continue."
exit 1
fi
if [[ "$REF" == "refs/tags/v"* ]]; then
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
tag=${tag:1}
else
tag=$(git log -1 --format="%cd" --date=short | sed s/-//g)
fi
echo "IMAGE=daeuniverse/daed" >> $GITHUB_OUTPUT
echo "TAG=$tag" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: buildx
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghrc.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ github.repository_owner }}
password: ${{ secrets.QUAY_PASS }}
- name: Build image
if: github.event_name == 'release'
uses: docker/build-push-action@v5
with:
context: .
build-args: DAED_VERSION=${{ steps.prep.outputs.TAG }}
builder: ${{ steps.buildx.outputs.name }}
file: publish.Dockerfile
target: prod
platforms: linux/386,linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ steps.prep.outputs.TAG }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.prep.outputs.TAG }}
quay.io/${{ github.repository }}:latest
quay.io/${{ github.repository }}:${{ steps.prep.outputs.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Build
if: github.event_name != 'release'
uses: docker/build-push-action@v5
with:
context: .
build-args: DAED_VERSION=${{ steps.prep.outputs.TAG }}
builder: ${{ steps.buildx.outputs.name }}
file: publish.Dockerfile
target: prod
platforms: linux/386,linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
${{ github.repository }}:test
${{ github.repository }}:${{ steps.prep.outputs.TAG }}-test
ghcr.io/${{ github.repository }}:test
ghcr.io/${{ github.repository }}:${{ steps.prep.outputs.TAG }}-test
quay.io/${{ github.repository }}:test
quay.io/${{ github.repository }}:${{ steps.prep.outputs.TAG }}-test
cache-from: type=gha
cache-to: type=gha,mode=max