mirror of
https://github.com/requarks/wiki.git
synced 2026-08-26 21:27:10 -05:00
ci: build assets outside docker
This commit is contained in:
+30
-17
@@ -15,6 +15,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js environment
|
||||||
|
uses: actions/setup-node@v2.5.2
|
||||||
|
with:
|
||||||
|
node-version: 20.x
|
||||||
|
|
||||||
- name: Set Build Variables
|
- name: Set Build Variables
|
||||||
run: |
|
run: |
|
||||||
echo "REL_VERSION=3.0.0-alpha.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
echo "REL_VERSION=3.0.0-alpha.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
||||||
@@ -33,6 +38,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
read_key: ${{ secrets.LOCALAZY_KEY_READ }}
|
read_key: ${{ secrets.LOCALAZY_KEY_READ }}
|
||||||
|
|
||||||
|
- name: Build Assets
|
||||||
|
working-directory: ux
|
||||||
|
run: |
|
||||||
|
npm ci --audit=false --fund=false
|
||||||
|
npm run build
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
@@ -56,24 +67,26 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
# cache-from: type=gha
|
# cache-from: type=gha
|
||||||
# cache-to: type=gha,mode=max
|
# cache-to: type=gha,mode=max
|
||||||
# platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/requarks/wiki:${{ env.REL_VERSION }}
|
ghcr.io/requarks/wiki:${{ env.REL_VERSION }}
|
||||||
|
|
||||||
- name: Extract compiled files
|
- name: Prepare build archive
|
||||||
run: |
|
run: |
|
||||||
mkdir -p _dist
|
mkdir -p _dist
|
||||||
docker create --name wiki ghcr.io/requarks/wiki:$REL_VERSION_STRICT
|
cp assets _dist/assets
|
||||||
docker cp wiki:/wiki _dist
|
cp server _dist/server
|
||||||
docker rm wiki
|
cp LICENSE _dist/LICENSE
|
||||||
rm _dist/wiki/config.yml
|
cp config.sample.yml _dist/config.sample.yml
|
||||||
cp ./config.sample.yml _dist/wiki/config.sample.yml
|
cd server
|
||||||
find _dist/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C _dist/wiki/ -T -
|
npm ci --omit=dev --audit=false --fund=false
|
||||||
|
cd ..
|
||||||
|
tar -czf wiki-js.tar.gz --no-recursion -C _dist .
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
- name: Upload Build Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: drop
|
name: build
|
||||||
path: wiki-js.tar.gz
|
path: wiki-js.tar.gz
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
@@ -85,18 +98,18 @@ jobs:
|
|||||||
- name: Setup Node.js environment
|
- name: Setup Node.js environment
|
||||||
uses: actions/setup-node@v2.5.2
|
uses: actions/setup-node@v2.5.2
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 20.x
|
||||||
|
|
||||||
- name: Download a Build Artifact
|
- name: Download Build Artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: drop
|
name: build
|
||||||
path: drop
|
path: build
|
||||||
|
|
||||||
- name: Extract Build
|
- name: Extract Build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p win
|
mkdir -p win
|
||||||
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=server/node_modules
|
tar -xzf $env:GITHUB_WORKSPACE\build\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=server/node_modules
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci --omit=dev --audit=false --fund=false
|
run: npm ci --omit=dev --audit=false --fund=false
|
||||||
@@ -105,9 +118,9 @@ jobs:
|
|||||||
- name: Create Bundle
|
- name: Create Bundle
|
||||||
run: tar -czf wiki-js-windows.tar.gz -C $env:GITHUB_WORKSPACE\win .
|
run: tar -czf wiki-js-windows.tar.gz -C $env:GITHUB_WORKSPACE\win .
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
- name: Upload Build Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: drop-win
|
name: build-win
|
||||||
path: wiki-js-windows.tar.gz
|
path: wiki-js-windows.tar.gz
|
||||||
|
|
||||||
|
|||||||
+1
-20
@@ -1,22 +1,3 @@
|
|||||||
# ====================
|
|
||||||
# --- Build Assets ---
|
|
||||||
# ====================
|
|
||||||
FROM node:20 AS assets
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -qy build-essential
|
|
||||||
|
|
||||||
WORKDIR /wiki
|
|
||||||
|
|
||||||
COPY ./ux ./ux
|
|
||||||
COPY ./dev ./dev
|
|
||||||
|
|
||||||
RUN cd ux && \
|
|
||||||
npm ci --audit=false --fund=false && \
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# ===============
|
|
||||||
# --- Release ---
|
|
||||||
# ===============
|
|
||||||
FROM node:20
|
FROM node:20
|
||||||
LABEL maintainer="requarks.io"
|
LABEL maintainer="requarks.io"
|
||||||
|
|
||||||
@@ -35,7 +16,7 @@ RUN mkdir -p /wiki && \
|
|||||||
|
|
||||||
WORKDIR /wiki
|
WORKDIR /wiki
|
||||||
|
|
||||||
COPY --chown=node:node --from=assets /wiki/assets ./assets
|
COPY --chown=node:node ./assets ./assets
|
||||||
COPY --chown=node:node ./server ./server
|
COPY --chown=node:node ./server ./server
|
||||||
COPY --chown=node:node ./dev/build/config.yml ./config.yml
|
COPY --chown=node:node ./dev/build/config.yml ./config.yml
|
||||||
COPY --chown=node:node ./LICENSE ./LICENSE
|
COPY --chown=node:node ./LICENSE ./LICENSE
|
||||||
|
|||||||
Reference in New Issue
Block a user