Repository navigation
93 lines (81 loc) · 2.5 KB
/
Copy pathrelease.yml
File metadata and controls
93 lines (81 loc) · 2.5 KB
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
89
90
91
92
93
name: release
on:
release:
types:
- published
permissions:
contents: read
jobs:
version:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.version.outputs.package_version }}
steps:
- name: Determine package version
id: version
shell: bash
run: |
set -euo pipefail
tag_name="${GITHUB_REF#refs/tags/}"
if [ -z "$tag_name" ]; then
tag_name="${{ github.event.release.tag_name }}"
fi
package_version=${tag_name##v}
echo "Using package version: $package_version"
echo "package_version=$package_version" >> "$GITHUB_OUTPUT"
build:
needs: version
uses: ./.github/workflows/build-packages.yml
with:
package_version: ${{ needs.version.outputs.package_version }}
run_tests: false
publish:
needs:
- version
- build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write # enable GitHub OIDC token issuance for this job
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
steps:
- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 11.x
- name: Download package artifacts
uses: actions/download-artifact@v7
with:
name: typstsharp-${{ needs.version.outputs.package_version }}
path: artifacts
# Get a short-lived NuGet API key
- name: NuGet login (OIDC -> temp API key)
uses: NuGet/login@v1
id: login
with:
user: evolvedlight
- name: Publish runtime packages to NuGet.org
shell: bash
run: |
set -euo pipefail
dotnet nuget push artifacts/typstsharp.runtime.*.nupkg \
--api-key ${{ steps.login.outputs.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Publish main package to NuGet.org
shell: bash
run: |
set -euo pipefail
dotnet nuget push "artifacts/typstsharp.${{ needs.version.outputs.package_version }}.nupkg" \
--api-key ${{ steps.login.outputs.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Upload release assets
uses: softprops/action-gh-release@v3
with:
files: artifacts/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}