Skip to content

v5.4.0-alpha.16

v5.4.0-alpha.16 #82

Workflow file for this run

name: release
on:
push:
tags: ['*']
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
build-standalone:
runs-on: ubuntu-latest
env:
DOCS_BASE_URL: /kb/
DOCS_HOME_URL: /
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/\./_/g') >> $GITHUB_OUTPUT
- name: Install
uses: wyvox/action-setup-pnpm@v3
- id: Optimize
run: pnpm optimize
- id: Build
run: pnpm build
- name: Pack
run: |
sed -i "s/__VERSION__/$(echo ${{ steps.get_version.outputs.VERSION }} | cut -c 2- | sed -e 's/_/./g' | sed -e 's/-/~/g')/g" deb/DEBIAN/control
sed -i "s/__INSTALLED_SIZE__/$(du -sk build | cut -f 1)/g" deb/DEBIAN/control
cat deb/DEBIAN/control
mkdir -p deb/usr/share/cloudpss/static/${{ env.DOCS_BASE_URL }}/
cp -a build/. deb/usr/share/cloudpss/static/${{ env.DOCS_BASE_URL }}/
dpkg-deb --build --root-owner-group -Zxz -z9 -Sextreme deb .
ls -l *.deb
- name: Upload Release Asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: '*.deb'
prerelease: ${{ contains(github.event.ref, '-') }}
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
build-public:
runs-on: ubuntu-latest
env:
DOCS_BASE_URL: /
DOCS_HOME_URL: https://cloudpss.net/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/\./_/g') >> $GITHUB_OUTPUT
- name: Install
uses: wyvox/action-setup-pnpm@v3
- id: Optimize
run: pnpm optimize
- id: Build
run: pnpm build
- name: Precompress
run: pnpm gzipper compress --exclude jpeg,jpg,png,gif,ico,mp3,mp4,mkv,zip --brotli --remove-larger ./build
- name: Pack
run: |
XZ_OPT=-e9 tar -cJf dist.tar.xz -C ./build .
ls -l dist.tar.xz
- name: Upload Release Asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: dist.tar.xz
prerelease: ${{ contains(github.event.ref, '-') }}
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
script: rm -f /root/docs/dist.tar.xz
- name: Deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
source: ./dist.tar.xz
target: /root/docs/
- name: Post-deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
script: |
rm -rf /root/docs/${{ steps.get_version.outputs.VERSION }}
mkdir -p /root/docs/${{ steps.get_version.outputs.VERSION }}
tar -xJf /root/docs/dist.tar.xz -C /root/docs/${{ steps.get_version.outputs.VERSION }}
rm -f /root/docs/latest
ln -s /root/docs/${{ steps.get_version.outputs.VERSION }} /root/docs/latest
rm -f /root/docs/dist.tar.xz
systemctl reload caddy
ls -l /root/docs/
- name: Release
uses: appleboy/[email protected]
if: ${{ !contains(steps.get_version.outputs.VERSION, '-') }}
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
script: |
rm -f /root/docs/release
ln -s /root/docs/${{ steps.get_version.outputs.VERSION }} /root/docs/release
systemctl reload caddy
ls -l