-
-
Notifications
You must be signed in to change notification settings - Fork 11
88 lines (84 loc) · 2.68 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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@v3
with:
dotnet-version: 7.x
cache: true
cache-dependency-path: '**/packages.lock.json'
- name: Set OS_ARG environment variable
run: |
if ("${{ runner.os }}" -eq "Windows") {
echo "OS_ARG=win10" | 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@v3
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@v3
- 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 }}