Skip to content

contents(fdroid): add first time install instructions (#172) #87

contents(fdroid): add first time install instructions (#172)

contents(fdroid): add first time install instructions (#172) #87

Workflow file for this run

name: Npm build and Publish to another branch
on:
workflow_dispatch:
push:
branches: ["*"]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# Currently mirrorz build is done by cloudflare pages, so here we only build cernet
# build_type: [mirrorz, cernet]
build_type: [cernet]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Prepare env
run: |
if [ ${{ matrix.build_type }} == 'cernet' ]; then
echo "NEXT_PUBLIC_SITE_HOST=help.mirrors.cernet.edu.cn" > .env.local
echo "NEXT_PUBLIC_JSON_ENDPOINT=https://mirrors.cernet.edu.cn/static/json/legacy-pack.json" >> .env.local
echo "NEXT_PUBLIC_MIRROZ_HOST=mirrors.cernet.edu.cn" >> .env.local
else
echo "Unexpected build type: ${{ matrix.build_type }}"
exit 1
fi
- name: Install dependencies
run: npm install
- name: Build
run: |
npm run og:build && npm run build
tar -czf out-${{ matrix.build_type }}.tar.gz out
- name: Upload out directory as artifact
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.build_type }}
path: out-${{ matrix.build_type }}.tar.gz
retention-days: 3
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [cernet]
if: ${{ github.ref == 'refs/heads/master' }}
needs:
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist-${{ matrix.build_type }}
- name: Commit and publish
run: |
case "${{ matrix.build_type }}" in
cernet) branch=cernet-pages;;
*) echo "Unknown build type ${{ matrix.build_type }}"
exit 1;;
esac
source_msg="$(git log -1 --pretty="[%h] %B")"
tar zxf out-${{ matrix.build_type }}.tar.gz -C /tmp
git checkout -f "$branch"
git rm -rf .
git clean -dfx
rsync -a /tmp/out/ ./
touch .nojekyll
git add -A
git -c user.name="Mirrorz Bot" -c user.email="bot@mirrorz.org" \
commit --allow-empty \
-m "GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$source_msg"
git push -f origin "$branch"