-
Notifications
You must be signed in to change notification settings - Fork 34
93 lines (78 loc) · 3.6 KB
/
ci.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
89
90
91
92
93
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build win-x64
run: dotnet publish CentralisedPackageConverter.sln -c Release --runtime win-x64 --self-contained -o cent-pack-convert-win-x64 /p:AssemblyVersion=1.0.${{ github.run_number }}
- name: Build linux-x64
run: dotnet publish CentralisedPackageConverter.sln -c Release --runtime linux-x64 --self-contained -o cent-pack-convert-linux-x64 /p:AssemblyVersion=1.0.${{ github.run_number }}
- name: Build osx-x64
run: dotnet publish CentralisedPackageConverter.sln -c Release --runtime osx-x64 --self-contained -o cent-pack-convert-osx-x64 /p:AssemblyVersion=1.0.${{ github.run_number }}
- name: Pack .NET Core tool
run: dotnet pack -c Release CentralisedPackageConverter.sln /p:Version=1.0.${{ github.run_number }}
- name: Pack executables
shell: bash
run: |
7z a -tzip "./artifacts/cent-pack-convert-win-x64.zip" "./cent-pack-convert-win-x64/*"
tar czvf "./artifacts/cent-pack-convert-linux-x64.tar.gz" "cent-pack-convert-linux-x64"
tar czvf "./artifacts/cent-pack-convert-osx-x64.tar.gz" "cent-pack-convert-osx-x64"
rm -r "cent-pack-convert-win-x64"
rm -r "cent-pack-convert-linux-x64"
rm -r "cent-pack-convert-osx-x64"
- name: Create the Release
id: create_release
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: 1.0.${{ github.run_number }}
release_name: Release 1.0.${{ github.run_number }}
draft: false
- name: Upload cent-pack-convert-win-x64.zip
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/cent-pack-convert-win-x64.zip
asset_name: cent-pack-convert-win-x64.zip
asset_content_type: application/zip
- name: Upload cent-pack-convert-linux-x64.zip
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/cent-pack-convert-linux-x64.tar.gz
asset_name: cent-pack-convert-linux-x64.tar.gz
asset_content_type: application/gzip
- name: Upload cent-pack-convert-osx-x64.zip
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/cent-pack-convert-osx-x64.tar.gz
asset_name: cent-pack-convert-osx-x64.tar.gz
asset_content_type: application/gzip
- name: Push to nuget.org
run: dotnet nuget push CentralisedPackageConverter/nupkg/CentralisedPackageConverter.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
if: ${{ github.event_name == 'push' }}