mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-29 10:17:58 +03:00
add server/website build script
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '^v?(?:[0-9]+.?){1,4}$'
|
||||
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_ENV
|
||||
|
||||
build-server:
|
||||
runs-on: windows-latest
|
||||
needs: get-upload-url
|
||||
name: Build amnet-server
|
||||
|
||||
env:
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.x'
|
||||
|
||||
- name: Set version
|
||||
run: |
|
||||
$tag="${{ github.event.inputs.tag || github.ref_name }}".TrimStart("v")
|
||||
echo "VERSION=$tag" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Publish
|
||||
run: dotnet publish -c Release -r win-x64 -o .\build-out -p:Version=$env:VERSION AMNet.Server\AMNet.Server.csproj
|
||||
|
||||
- name: Upload artifact
|
||||
run: |
|
||||
curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary "@.\build-out\amnet.dll" "${{ needs.get-upload-url.outputs.upload_url }}?name=amnet.dll"
|
||||
|
||||
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"
|
||||
Reference in New Issue
Block a user