92 lines
2.6 KiB
YAML

name: Release
on:
push:
tags: [ v* ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
github-release:
name: Create a GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: checkout
uses: actions/checkout@v4
- name: install node.js v20
uses: actions/setup-node@v2
with:
node-version: '20'
- name: install dependencies
run: npm ci
- name: build
run: |
npx prisma generate
npm run patch-font
npm run build
cp -r .next/standalone build
cp -r .next/static build/.next/static
cp -r public build/public
- name: compress
working-directory: build
run: |
tar -zcf ../${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz * .[^.]+
zip -rq ../${{ github.event.repository.name }}-${{ github.ref_name }}.zip * .[^.]+
- name: upload artifact
uses: actions/upload-artifact@v3
id: upload-artifact-step
with:
name: ${{ github.event.repository.name }}-${{ github.ref_name }}
path: build
- name: create draft release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
files: |
${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz
${{ github.event.repository.name }}-${{ github.ref_name }}.zip
draft: true
generate_release_notes: true
docker:
name: Build docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: checkout
uses: actions/checkout@v4
- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}