mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-22 22:28:22 +03:00
84 lines
2.6 KiB
YAML
84 lines
2.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Tag Name'
|
|
required: true
|
|
|
|
jobs:
|
|
get-upload-url:
|
|
runs-on: ubuntu-latest
|
|
name: Get Asset Upload URL
|
|
|
|
outputs:
|
|
upload_url: ${{ steps.get-url.outputs.url }}
|
|
|
|
env:
|
|
TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
|
|
|
steps:
|
|
- name: Get Upload URL
|
|
id: get-url
|
|
run: |
|
|
UPLOAD_URL=$(curl -s -X GET -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" "https://gitea.tendokyu.moe/api/v1/repos/ppc/amnet/releases/tags/$TAG" | jq -r '.upload_url')
|
|
echo "url=$UPLOAD_URL" >> $GITHUB_OUTPUT
|
|
|
|
build-server:
|
|
runs-on: windows-latest
|
|
needs: get-upload-url
|
|
name: Build amnet-server
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- { target: "x86_64-pc-windows-msvc", filename: "amnet.dll", include_test_server: true }
|
|
- { target: "i686-pc-windows-msvc", filename: "amnet_x86.dll", include_test_server: false }
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set target
|
|
run: |
|
|
rustup target add ${{ matrix.target }}
|
|
rustup set default-host ${{ matrix.target }}
|
|
|
|
- name: Perform build
|
|
run: cargo build --release
|
|
|
|
- name: Upload .dll
|
|
run: |
|
|
curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary "@.\amnet-server\target\release\amnet.dll" "${{ needs.get-upload-url.outputs.upload_url }}?name=${{ matrix.filename }}"
|
|
|
|
- name: Upload test server
|
|
if: "matrix.include_test_server"
|
|
run: |
|
|
curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary "@.\amnet-server\target\release\amnet-server-test.exe" "${{ needs.get-upload-url.outputs.upload_url }}?name=amnet-server.exe"
|
|
|
|
build-website:
|
|
runs-on: ubuntu-latest
|
|
needs: get-upload-url
|
|
name: Build amnet-web
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
working-directory: ${{ github.workspace }}/amnet-web
|
|
run: npm install
|
|
|
|
- name: Build
|
|
working-directory: ${{ github.workspace }}/amnet-web
|
|
run: npm run build
|
|
|
|
- name: Archive Result
|
|
run: zip -r amnet-web.zip ./amnet-web/dist/
|
|
|
|
- name: Upload
|
|
run: |
|
|
curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary "@./amnet-web.zip" "${{ needs.get-upload-url.outputs.upload_url }}?name=amnet-web.zip"
|