Feat/svelte rewrite #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Web Build | |
on: | |
push: | |
branches: [ '*' ] | |
paths: | |
- 'adnmb-backup-web/**' | |
- '.github/workflows/web.yml' | |
pull_request: | |
branches: [ '*' ] | |
paths: | |
- 'adnmb-backup-web/**' | |
- '.github/workflows/web.yml' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
platform: win | |
arch: x64 | |
ext: .exe | |
- os: ubuntu-latest | |
platform: linux | |
arch: x64 | |
- os: ubuntu-22.04-arm | |
platform: linux | |
arch: arm64 | |
- os: macos-latest | |
platform: macos | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Install dependencies | |
working-directory: ./adnmb-backup-web | |
run: pnpm install --frozen-lockfile | |
- name: Check Project | |
working-directory: ./adnmb-backup-web | |
run: pnpm check | |
- name: Build project | |
working-directory: ./adnmb-backup-web | |
run: pnpm build | |
- name: Create build archive | |
shell: bash | |
run: | | |
cd adnmb-backup-web | |
if [ -d "build" ]; then | |
tar -czf "../adnmb-backup-web-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" -C build . | |
elif [ -d ".svelte-kit/output" ]; then | |
tar -czf "../adnmb-backup-web-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" -C .svelte-kit/output . | |
else | |
echo "Build directory not found" | |
ls -la | |
exit 1 | |
fi | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: adnmb-backup-web-${{ matrix.platform }}-${{ matrix.arch }} | |
path: adnmb-backup-web-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz | |
retention-days: 30 | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Display structure of downloaded files | |
run: ls -R artifacts/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: web-${{ github.sha }} | |
release_name: Web Build ${{ github.sha }} | |
draft: false | |
prerelease: true | |
- name: Upload Release Assets | |
run: | | |
for file in artifacts/*/adnmb-backup-web-*.tar.gz; do | |
if [ -f "$file" ]; then | |
filename=$(basename "$file") | |
echo "Uploading $filename" | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/octet-stream" \ | |
"${{ steps.create_release.outputs.upload_url }}?name=$filename" \ | |
--data-binary "@$file" | |
fi | |
done | |