8aa224dcb9
Signed-off-by: TanKanT97 <108915004+TanKanT97@users.noreply.github.com>
130 lines
3.2 KiB
YAML
130 lines
3.2 KiB
YAML
name: Build and Release
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
release:
|
|
types: [created]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Copy assets to dist
|
|
run: |
|
|
cp src/download0/payloads/*.elf dist/download0/payloads/
|
|
cp src/download0/payloads/*.bin dist/download0/payloads/
|
|
cp -r src/download0/img dist/download0/
|
|
cp -r src/download0/sfx dist/download0/
|
|
cp -r src/download0/vid dist/download0/
|
|
cp src/download0/*.aes dist/download0/
|
|
|
|
- name: Encrypt savedata
|
|
run: |
|
|
pip install cryptography
|
|
python src/tools/encrypt_aes_files.py src/savedata/localstorage
|
|
mkdir -p dist/savedata
|
|
cp src/savedata/localstorage.aes dist/savedata/
|
|
|
|
- name: Zip dist
|
|
run: cd dist && zip -r ../vue-after-free-${{ github.ref_name }}.zip download0/ savedata/ && cd ..
|
|
|
|
- name: Upload dist artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: vue-after-free-${{ github.ref_name }}
|
|
path: vue-after-free-${{ github.ref_name }}.zip
|
|
|
|
- name: Upload release asset
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: vue-after-free-${{ github.ref_name }}.zip
|
|
|
|
ufs-image:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download dist artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
- name: Create UFS2 image in FreeBSD
|
|
uses: vmactions/freebsd-vm@v1
|
|
with:
|
|
release: "14.2"
|
|
copyback: true
|
|
prepare: ""
|
|
run: |
|
|
set -e
|
|
|
|
# Create 256MB image file
|
|
truncate -s 256M download0.dat
|
|
|
|
# Attach as memory disk (returns e.g. "md0")
|
|
MD=$(mdconfig -a -t vnode -f "$(pwd)/download0.dat")
|
|
|
|
# Create UFS2 filesystem
|
|
newfs -O 2 -b 32768 -f 4096 /dev/${MD}
|
|
|
|
# Mount
|
|
mount /dev/${MD} /mnt
|
|
|
|
# Copy dist contents
|
|
cp -R dist/download0/* /mnt/
|
|
|
|
# Create empty dirs
|
|
mkdir -p /mnt/mgl /mnt/video_cache /mnt/xhr_cache
|
|
|
|
# Set permissions
|
|
chmod -R 777 /mnt/*
|
|
|
|
# Unmount and detach
|
|
umount /mnt
|
|
mdconfig -d -u ${MD}
|
|
|
|
- name: Verify image
|
|
run: file download0.dat
|
|
|
|
- name: Upload UFS2 image artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: download0.dat
|
|
path: download0.dat
|
|
|
|
- name: Delete dist artifact
|
|
uses: geekyeggo/delete-artifact@v5
|
|
with:
|
|
name: dist
|
|
|
|
- name: Upload UFS2 release asset
|
|
if: github.event_name == 'release'
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: download0.dat
|