Skip to content

Build

Build #21

Workflow file for this run

name: Build
on:
workflow_dispatch:
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: "5.x"
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Restore dependencies
run: dotnet restore
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Extract Version from .csproj
id: extract_version
run: |
version=$(xmllint --xpath "string(//Project/PropertyGroup/Version)" Bloodcraft.csproj)
echo "##[set-output name=version;]$version"
- name: Update manifest.json
run: |
version=${{ steps.extract_version.outputs.version }}
jq --arg version "$version" '.version_number = $version' manifest.json > temp.json && mv temp.json manifest.json
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
with:
additionalArguments: '/updateprojectfiles /overrideconfig "mode=Mainline"'
- name: Build (Release)
run: dotnet build . --configuration Release -p:Version=${{ steps.extract_version.outputs.version }}
- name: Publish (Release)
run: dotnet publish . --configuration Release --output ./output
- name: Copy build artifacts
run: |
mkdir -p release_artifacts
cp ./output/Bloodcraft.dll release_artifacts/
cp manifest.json release_artifacts/
cp CHANGELOG.md release_artifacts/
cp README.md release_artifacts/
cp icon.png release_artifacts/
- name: GH Release
uses: softprops/action-gh-release@v1
if: github.event_name == 'workflow_dispatch'
with:
body: Manual pre-release of ${{ env.version }} for ${{ env.GitVersion_ShortSha }}
name: v${{ env.version }}
fail_on_unmatched_files: true
prerelease: true
tag_name: v${{ env.version }}
files: |
release_artifacts/Bloodcraft.dll
release_artifacts/manifest.json
release_artifacts/CHANGELOG.md
release_artifacts/README.md
release_artifacts/icon.png
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}