Skip to content

Commit 59cb1e6

Browse files
Upload archives with source code on release (Thalhammer#324)
* upload tar.gz for new releases * revert name to manually trigger it * write to separate path * Update and rename nuget.yml to release.yml * disable nuget for testing * add a zip as well * error handling * Update release.yml * simple conditional trying https://unix.stackexchange.com/a/344207 * Update release.yml * back to basics * exclude .git folder * fix order for args * protect glob * fix order * remove remove testing code
1 parent 8ed685e commit 59cb1e6

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

.github/workflows/nuget.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Nuget CD
2+
3+
on:
4+
# Allows you to run this workflow manually from the Actions tab
5+
workflow_dispatch:
6+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
nuget:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup NuGet
16+
uses: NuGet/setup-nuget@v1
17+
with:
18+
nuget-api-key: ${{ secrets.nuget_api_key }}
19+
20+
- name: Create NuGet pkg
21+
working-directory: ./nuget
22+
run: nuget pack jwt-cpp.nuspec
23+
24+
- name: Publish NuGet pkg
25+
working-directory: ./nuget
26+
run: nuget push *.nupkg -Source 'https://api.nuget.org/v3/index.json'
27+
28+
release-asset:
29+
if: github.event_name != 'workflow_dispatch'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- run: tar --exclude='./.git' -vczf /tmp/jwt-cpp-${{ github.event.release.tag_name }}.tar.gz .
35+
- uses: shogo82148/actions-upload-release-asset@v1
36+
with:
37+
upload_url: ${{ github.event.release.upload_url }}
38+
asset_path: /tmp/jwt-cpp-${{ github.event.release.tag_name }}.tar.gz
39+
40+
- run: zip -x './.git/*' -r /tmp/jwt-cpp-${{ github.event.release.tag_name }}.zip .
41+
- uses: shogo82148/actions-upload-release-asset@v1
42+
with:
43+
upload_url: ${{ github.event.release.upload_url }}
44+
asset_path: /tmp/jwt-cpp-${{ github.event.release.tag_name }}.zip

0 commit comments

Comments
 (0)