mirror of https://github.com/requarks/wiki
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.
107 lines
3.1 KiB
107 lines
3.1 KiB
name: Build (Linux, no Docker)
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags: [ 'v*' ]
|
|
workflow_dispatch: {}
|
|
|
|
env:
|
|
BASE_DEV_VERSION: 2.5.0
|
|
|
|
jobs:
|
|
build-linux:
|
|
name: Build Wiki.js tarball
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Build Variables
|
|
run: |
|
|
if [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
|
|
echo "Using TAG mode: $GITHUB_REF_NAME"
|
|
echo "REL_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
|
|
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
|
|
else
|
|
echo "Using BRANCH mode: v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER"
|
|
echo "REL_VERSION=v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
|
echo "REL_VERSION_STRICT=$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.x'
|
|
cache: 'yarn'
|
|
|
|
- name: Install OS build deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y jq build-essential python3
|
|
|
|
- name: Disable DEV flag + set version
|
|
run: |
|
|
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 | head -n 50
|
|
|
|
- name: Install dependencies (production lockfile)
|
|
run: |
|
|
corepack enable
|
|
yarn --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: |
|
|
# Typical Wiki.js build script compiles server + client
|
|
yarn build
|
|
|
|
- name: Create deploy bundle (Linux)
|
|
run: |
|
|
mkdir -p _dist/wiki
|
|
rsync -a \
|
|
--exclude='.git' \
|
|
--exclude='.github' \
|
|
--exclude='node_modules' \
|
|
--exclude='.yarn/*' \
|
|
--exclude='.yarnrc*' \
|
|
--exclude='.yarn.lock.*' \
|
|
./ _dist/wiki/
|
|
(cd _dist/wiki && rm -rf node_modules && yarn --production --frozen-lockfile)
|
|
cp ./config.sample.yml _dist/wiki/config.sample.yml
|
|
rm -f _dist/wiki/config.yml
|
|
find _dist/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C _dist/wiki/ -T -
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wiki-js-linux
|
|
path: wiki-js.tar.gz
|
|
|
|
release:
|
|
name: Attach tarball to Release (tag builds)
|
|
runs-on: ubuntu-latest
|
|
needs: [build-linux]
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: wiki-js-linux
|
|
path: dist
|
|
|
|
- name: Update GitHub Release
|
|
uses: ncipollo/release-action@v1.13.0
|
|
with:
|
|
allowUpdates: true
|
|
draft: false
|
|
makeLatest: true
|
|
name: ${{ github.ref_name }}
|
|
body: "Automated Linux build for ${{ github.ref_name }}"
|
|
artifacts: 'dist/wiki-js.tar.gz'
|