You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/.github/workflows/build.yml

131 lines
3.4 KiB

name: Build + Publish
on:
push:
branches:
- scarlett
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- name: Setup Node.js environment
uses: actions/setup-node@v7
with:
node-version: 26.x
- name: Set Build Variables
run: |
echo "REL_VERSION=3.0.0-beta.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
- name: Set Version
run: |
yq -iP '.version = strenv(REL_VERSION)' backend/package.json -o json
yq -iP '.version = strenv(REL_VERSION)' frontend/package.json -o json
- name: Upload translations source file
uses: crowdin/github-action@v3
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
CROWDIN_BASE_PATH: ${{ github.workspace }}
with:
command: 'upload'
command_args: '--config dev/crowdin.yml'
- name: Build Assets
working-directory: frontend
run: |
npm ci
npm run build
- name: Build Blocks
working-directory: blocks
run: |
npm ci
npm run build
- name: Generate Docker Meta
id: meta
uses: docker/metadata-action@v6
with:
flavor: |
latest=false
images: |
requarks/wiki
ghcr.io/requarks/wiki
tags: |
type=semver,pattern={{version}},value=${{ env.REL_VERSION }}
type=raw,value=3.0.0-beta
annotations: |
manifest:org.opencontainers.image.title=Wiki.js
manifest:org.opencontainers.image.description=Next Generation Open Source Wiki
manifest:org.opencontainers.image.documentation=https://docs.js.wiki
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push Docker images
uses: docker/build-push-action@v7
with:
context: .
file: dev/build/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
- name: Prepare build archive
run: |
mkdir -p _dist/blocks
cp -R assets _dist/assets
cp -R blocks/compiled _dist/blocks/compiled
cp -R backend _dist/backend
cp LICENSE _dist/LICENSE
cp config.sample.yml _dist/config.sample.yml
cd _dist/backend
npm ci --omit=dev
cd -
find ./_dist/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C ./_dist/ -T -
- name: Upload Build Artifact
uses: actions/upload-artifact@v7
with:
name: build
path: wiki-js.tar.gz
# - name: Create Prerelease
# uses: ncipollo/release-action@v1.21.0
# with:
# prerelease: true
# draft: false
# owner: requarks
# repo: wiki
# commit: ${{ github.sha }}
# tag: ${{ env.REL_VERSION }}
# name: ${{ env.REL_VERSION }}
# omitBody: true
# token: ${{ github.token }}