Skip to content

Build

Build #39

Workflow file for this run

name: Build
permissions:
contents: write
on:
workflow_dispatch:
push:
branches: [main]
tags:
- '*'
pull_request:
branches: [main, download-assets]
env:
PROJECT_NAME: DragoonMayCry
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
- name: Build
run: |
dotnet restore
dotnet build --configuration Release --nologo --output bin/
env:
DOTNET_CLI_TELEMETRY_OUTPUT: true
- name: Create artifact
run: |
Compress-Archive -Path "bin/*" -DestinationPath ${{env.PROJECT_NAME}}.zip
- name: Upload artifact
uses: actions/[email protected]
with:
name: PluginZip
path: DragoonMayCry.zip
if-no-files-found: error
release:
needs: build
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x.x'
- name: Restore dependencies
run: dotnet restore
- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev"
- name: Build
run: |
$ver = '${{ github.ref }}' -replace 'refs/tags/',''
invoke-expression 'dotnet build --no-restore --configuration Release --nologo -p:Version=$ver -p:FileVersion=$ver -p:AssemblyVersion=$ver'
- name: Archive
run: |
$ver = '${{ github.ref }}' -replace 'refs/tags/',''
Compress-Archive -Path ${{ env.PROJECT_NAME }}\bin\x64\Release\* -DestinationPath ${{ env.PROJECT_NAME }}.zip
'{ "version": "' + $ver + '" }' | Out-File -FilePath '.\assets\manifest.json'
Compress-Archive -Path assets\* -DestinationPath assets.zip
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
path: |
./${{ env.PROJECT_NAME }}/bin/x64/Release/*
- name: Upload Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT }}
file: ./*.zip
file_glob: true