Skip to content

Build & Upload DocMost #12

Build & Upload DocMost

Build & Upload DocMost #12

name: Build & Upload DocMost
on:
push:
paths:
- 'package.json'
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
env:
DOCKER_IMAGE_NAME_DOCMOST: ghcr.io/awels-io/docmost
ENVIRONMENT: production
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code (custom app)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_REGISTRY_TOKEN }}
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Get version from package.json
id: get_version
run: |
VERSION=$(jq -r .version package.json)
if [[ -z "$VERSION" || "$VERSION" == "null" ]]; then
VERSION="dev"
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and push DocMost image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ env.DOCKER_IMAGE_NAME_DOCMOST }}:latest
${{ env.DOCKER_IMAGE_NAME_DOCMOST }}:${{ env.VERSION }}
${{ env.DOCKER_IMAGE_NAME_DOCMOST }}:${{ github.sha }}