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

114 lines
2.9 KiB

name: Build + Publish
on:
push:
branches:
- vega
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- name: Set Build Variables
run: |
echo "REL_VERSION=3.0.0-alpha.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
- name: Disable DEV Flag + Set Version
working-directory: server
run: |
sudo apt-get install jq -y
mv package.json pkg-temp.json
jq --arg vs "$REL_VERSION_STRICT" -r '. + {dev:false, version:$vs}' pkg-temp.json > package.json
rm pkg-temp.json
cat package.json
- name: Fetch Latest Locales
uses: localazy/download@v1
with:
read_key: ${{ secrets.LOCALAZY_KEY_READ }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
file: dev/build/Dockerfile
provenance: true
sbom: true
push: true
# cache-from: type=gha
# cache-to: type=gha,mode=max
# platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/requarks/wiki:${{ env.REL_VERSION }}
- name: Extract compiled files
run: |
mkdir -p _dist
docker create --name wiki ghcr.io/requarks/wiki:$REL_VERSION_STRICT
docker cp wiki:/wiki _dist
docker rm wiki
rm _dist/wiki/config.yml
cp ./config.sample.yml _dist/wiki/config.sample.yml
find _dist/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C _dist/wiki/ -T -
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: drop
path: wiki-js.tar.gz
windows:
name: Windows Build
runs-on: windows-latest
needs: [build]
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v2.5.2
with:
node-version: 18.x
- name: Download a Build Artifact
uses: actions/download-artifact@v3
with:
name: drop
path: drop
- name: Extract Build
run: |
mkdir -p win
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=server/node_modules
- name: Install Dependencies
run: npm ci --omit=dev --audit=false --fund=false
working-directory: win/server
- name: Create Bundle
run: tar -czf wiki-js-windows.tar.gz -C $env:GITHUB_WORKSPACE\win .
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: drop-win
path: wiki-js-windows.tar.gz