-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (57 loc) · 2.29 KB
/
Copy pathpreview.yml
File metadata and controls
60 lines (57 loc) · 2.29 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
name: Prerelease
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+-preview[0-9][0-9][0-9]"
env:
PROJECT_NAME: ${{ github.event.repository.name }}
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
GITHUB_SOURCE_URL: 'https://nuget.pkg.github.com/vdaular/index.json'
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json'
jobs:
build:
runs-on: ubuntu-latest
environment:
name: Prerelease
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify commit exists in origin/main
run: git branch --remote --contains | grep origin/main
- name: Extract release notes
run: |
git log --pretty=format:'%d %s' ${GITHUB_REF} | perl -pe 's| \(.*tag: v(\d+.\d+.\d+(-preview\d{3})?)(, .*?)*\)|\n## \1\n|g' > RELEASE-NOTES
working-directory: .
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-quality: 'preview'
- name: PWD
run: pwd
- name: LS
run: ls -ltrh
working-directory: ./src/${{ env.PROJECT_NAME }}
- name: Restore dependencies
run: dotnet restore
working-directory: ./src/${{ env.PROJECT_NAME }}
- name: Build
run: dotnet build --no-restore --configuration Release /p:Version=${VERSION}
working-directory: ./src/${{ env.PROJECT_NAME }}
- name: Test
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build
working-directory: ./tests/${{ env.PROJECT_NAME }}.Tests/${{ env.PROJECT_NAME }}.Tests
- name: Pack
run: dotnet pack --no-restore --no-build --configuration Release /p:Version=${VERSION} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
working-directory: ./src/${{ env.PROJECT_NAME }}
- name: Push to GitHub
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg --source ${{ env.GITHUB_SOURCE_URL }} --api-key ${GITHUB_TOKEN} --skip-duplicate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Nuget.org
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg -k ${{ secrets.NUGET_AUTH_TOKEN }} -s ${{ env.NUGET_SOURCE_URL }} --skip-duplicate