-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (98 loc) · 3.89 KB
/
dotnet.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
# force build
name: Deploy Blazor.QrCode
on:
# --Manual run--
workflow_dispatch:
# --Auto run--
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
# env:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
# - name: Pack
# run: dotnet pack ./Blazor.QrCode/Blazor.QrCode.csproj --configuration Release --output ./build
- name: Test
run: dotnet test --no-build --verbosity normal
# - name: Publish nuget
# run: dotnet nuget push ./build/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
# - name: Publish
# run: dotnet publish ./Blazor.QrCode/Blazor.QrCode.csproj -c Release --output ./publish
# - name: Publish to GitHub Packages
# run: dotnet nuget add source https://nuget.pkg.github.com/OWNER/index.json --name github --username OWNER --password ${{ secrets.GITHUB_TOKEN }}
# run: dotnet nuget push ./build/*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
# - name: Publish to GitHub
# uses: actions/upload-artifact@v2
# with:
# name: Blazor.QrCode
# path: ./Blazor.QrCode/bin/Debug/
- name: Restore dependencies
run: dotnet restore ./Blazor.QrCode/Blazor.QrCode.csproj
- name: Build nuget
run: dotnet build ./Blazor.QrCode/Blazor.QrCode.csproj --no-restore --configuration Release --output ./publish
# env:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: debug output 1
run: |
echo ${{ github.workspace }}
echo .$GITHUB_RUN_NUMBER
- name: Get version
# id must be specified to retrieve the output of the step
id: version-step
uses: michmich112/extract-version@main
with:
# specify here the path to your version file (e.g. package.json, pom.xml...)
version-file: VERSION
schema: major.minor.build
- name: test
run: |
echo "version -> $VERSION"
env:
VERSION: ${{ steps.version-step.outputs.version }}
- name: Get version 2
id: get_version
run: |
$dllPath = ${{ github.workspace }}/Blazor.QrCode/publish/Blazor.QrCode.dll
sudo apt-get install mono-runtime
#$versionInfo = Get-FileVersionInfo -FilePath $dllPath
#$version = $versionInfo.ProductVersion
###version=$(strings $dllPath | grep AssemblyVersion | cut -d' ' -f2)
version=$(monodis --assembly $dllPath | grep Version | cut -d' ' -f2)
echo "::set-output name=version::$version"
- name: Display release name
# empty
run: echo Release v${{ steps.get_version.outputs.version }}
- name: Create release
id: create_release
#uses: actions/create-release@v1
# https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v1
env:
#you can’t use ${{ secrets.GITHUB_TOKEN }} as it isn’t allowed to publish releases.
#GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT }} # need to create by user
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ github.workspace }}/publish/*.nupkg
tag_name: ${{ github.ref_name }}
#release_name: Release ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
# tag_name: ${{ needs.build-dev.outputs.version }}
# release_name: Release ${{ needs.build-dev.outputs.version }}
draft: false
prerelease: true