Publish #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: Version number | |
required: true | |
jobs: | |
create-tag: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Check Tag | |
id: check-tag | |
uses: KyoriPowered/action-regex-match@v4 | |
with: | |
text: ${{ github.event.inputs.version }} | |
regex: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' | |
- name: Fail if invalid | |
if: steps.check-tag.outputs.match == '' | |
uses: Actions/github-script@v7 | |
with: | |
script: | | |
core.setFailed('Invalid tag') | |
- uses: actions/checkout@v4 | |
- name: Create tag | |
run: | | |
git tag ${{ github.event.inputs.version }} | |
git push origin ${{ github.event.inputs.version }} | |
build: | |
needs: create-tag | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: pwsh | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
fail-fast: true | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.x | |
cache: true | |
cache-dependency-path: '**/packages.lock.json' | |
- run: dotnet restore --locked-mode | |
- name: Set OS_ARG environment variable | |
run: | | |
if ("${{ runner.os }}" -eq "Windows") { | |
echo "OS_ARG=win" | Out-File -FilePath $env:GITHUB_ENV -Append | |
} elseif ("${{ runner.os }}" -eq "Linux") { | |
echo "OS_ARG=linux" | Out-File -FilePath $env:GITHUB_ENV -Append | |
} elseif ("${{ runner.os }}" -eq "macOS") { | |
echo "OS_ARG=osx" | Out-File -FilePath $env:GITHUB_ENV -Append | |
} | |
- run: ./createpublishedzip.ps1 -os ${{ env.OS_ARG }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SFP_UI-${{ env.OS_ARG }}-x64-${{ github.sha }} | |
path: Release/SFP_UI-* | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Publish to Github | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "**/SFP_UI-*.*" | |
tag: ${{ github.event.inputs.version }} | |
commit: ${{ github.ref }} | |
artifactErrorsFailBuild: true | |
draft: true | |
allowUpdates: true | |
token: ${{ secrets.GITHUB_TOKEN }} |