Skip to content

Publish

Publish #6

Workflow file for this run

name: Publish
on:
release:
types: [published]
inputs:
is_release_event:
description: Should this be a release or a preview package
required: true
default: 'false'
jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.*
- name: Install dependencies
run: |
dotnet clean ${{ matrix.sln }} -c Release && dotnet nuget locals all --clear
dotnet restore ${{ matrix.sln }}
- name: Build
run: dotnet build ${{ matrix.sln }} -c Release --no-restore
- name: Test
run: dotnet test ${{ matrix.sln }} -c Release --no-build
build-test-push:
needs: [build-test]
runs-on: windows-latest
steps:
- name: Get timestamp
uses: 1466587594/get-current-time@v1
id: current-time
with:
format: YYYYMMDD-HHmmSS
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.*
- name: Install dependencies
run: |
dotnet clean Mutagen.Bethesda.Generation.Tools.sln -c Release && dotnet nuget locals all --clear
dotnet restore Mutagen.Bethesda.Generation.Tools.sln
- name: Build
run: dotnet build Mutagen.Bethesda.Generation.Tools.sln -c Release --no-restore /p:GeneratePackageOnBuild=false
- name: Pack
if: ${{ success() }}
run: |
dotnet pack Mutagen.Bethesda.Generation.Tools.sln -c Release -o out
- name: Pack Linux CLI
if: ${{ success() && !github.event.release.prerelease && github.event_name == 'release' }}
run: dotnet publish "Mutagen.Bethesda.Generation.Tools/Mutagen.Bethesda.Generation.Tools.csproj" --configuration Release -r linux-x64 -p:PublishSingleFile=True --self-contained True
- name: Pack CLI
if: ${{ success() && !github.event.release.prerelease && github.event_name == 'release' }}
run: dotnet publish "Mutagen.Bethesda.Generation.Tools/Mutagen.Bethesda.Generation.Tools.csproj" --configuration Release -r win-x64 -p:PublishSingleFile=True --self-contained True
- name: Archive Linux CLI
if: ${{ success() && !github.event.release.prerelease && github.event_name == 'release' }}
run: |
powershell Compress-Archive Mutagen.Bethesda.Generation.Tools/bin/Release/net8.0/linux-x64/publish/* MutagenGenerationTools-Linux.zip
- name: Archive CLI
if: ${{ success() && !github.event.release.prerelease && github.event_name == 'release' }}
run: |
powershell Compress-Archive Mutagen.Bethesda.Generation.Tools/bin/Release/net8.0/win-x64/publish/* MutagenGenerationTools.zip
- name: Publish Linux CLI to Github
if: ${{ success() && !github.event.release.prerelease && github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
file: MutagenGenerationTools-Linux.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.release.tag_name }}
- name: Publish CLI to Github
if: ${{ success() && !github.event.release.prerelease && github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
file: MutagenGenerationTools.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.release.tag_name }}