|
| 1 | +name: Build and Release Plugin Assets |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-release: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Setup Go |
| 21 | + uses: actions/setup-go@v5 |
| 22 | + with: |
| 23 | + go-version: "1.24" |
| 24 | + |
| 25 | + - name: Setup Bun |
| 26 | + uses: oven-sh/setup-bun@v2 |
| 27 | + with: |
| 28 | + bun-version: latest |
| 29 | + |
| 30 | + - name: Build backend WASM |
| 31 | + working-directory: backend |
| 32 | + run: | |
| 33 | + set -euo pipefail |
| 34 | + mkdir -p ../release/backend |
| 35 | + GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o ../release/backend/webhook.wasm . |
| 36 | +
|
| 37 | + - name: Build frontend |
| 38 | + working-directory: frontend |
| 39 | + run: | |
| 40 | + set -euo pipefail |
| 41 | + bun install --frozen-lockfile |
| 42 | + bun run build |
| 43 | +
|
| 44 | + - name: Collect release files |
| 45 | + run: | |
| 46 | + set -euo pipefail |
| 47 | + mkdir -p release/frontend |
| 48 | + cp -R frontend/dist release/frontend/dist |
| 49 | +
|
| 50 | + mkdir -p release/migrations |
| 51 | + cp -R backend/migrations/. release/migrations/ |
| 52 | +
|
| 53 | + cp plugin.json release/plugin.json |
| 54 | +
|
| 55 | + - name: Create archives |
| 56 | + run: | |
| 57 | + set -euo pipefail |
| 58 | + tar -czf webhook-backend-wasm.tar.gz -C release/backend webhook.wasm |
| 59 | + tar -czf webhook-frontend-dist.tar.gz -C release/frontend dist |
| 60 | + tar -czf webhook-migrations.tar.gz -C release migrations |
| 61 | + tar -czf webhook-plugin-manifest.tar.gz -C release plugin.json |
| 62 | +
|
| 63 | + - name: Generate checksums |
| 64 | + run: | |
| 65 | + set -euo pipefail |
| 66 | + sha256sum webhook-backend-wasm.tar.gz \ |
| 67 | + webhook-frontend-dist.tar.gz \ |
| 68 | + webhook-migrations.tar.gz \ |
| 69 | + webhook-plugin-manifest.tar.gz > checksums.txt |
| 70 | +
|
| 71 | + - name: Publish GitHub Release assets |
| 72 | + uses: softprops/action-gh-release@v2 |
| 73 | + with: |
| 74 | + generate_release_notes: true |
| 75 | + files: | |
| 76 | + webhook-backend-wasm.tar.gz |
| 77 | + webhook-frontend-dist.tar.gz |
| 78 | + webhook-migrations.tar.gz |
| 79 | + webhook-plugin-manifest.tar.gz |
| 80 | + checksums.txt |
0 commit comments