-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (103 loc) · 3.14 KB
/
publish.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Publish
env:
NUGET_OUTPUT: ./Artifacts/NuGet
DOTNET_VERSION: "6.0.400"
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
default: '0.0.0'
type: string
release-notes:
description: 'Release notes'
required: true
default: 'No release notes'
type: string
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
pull_request:
types: [closed]
branches:
- "**"
paths:
- "**"
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
publish: ${{ steps.release.outputs.should-publish }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Release
id: release
uses: aksio-insurtech/release-action@v1
with:
user-name: "Aksio Build"
user-email: "[email protected]"
version: ${{ github.event.inputs.version }}
release-notes: ${{ github.event.inputs.release-notes }}
publish-dotnet-packages:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .Net
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Remove any existing artifacts
run: rm -rf ${{ env.NUGET_OUTPUT }}
- name: Build
run: dotnet build --configuration Release
- name: Create NuGet packages
run: dotnet pack --no-build --configuration Release -o ${{ env.NUGET_OUTPUT }} -p:PackageVersion=${{ needs.release.outputs.version }}
- name: Push NuGet packages
run: dotnet nuget push --skip-duplicate '${{ env.NUGET_OUTPUT }}/*.nupkg' --timeout 900 --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
publish-npm-packages:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup node v16
uses: actions/setup-node@v3
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
node-version: 16.x
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
- name: Yarn install
run: yarn
- name: Publish NPM packages
run: |
yarn publish-version ${{ needs.release.outputs.version }}
- name: Git reset (package.json files changed)
run: |
git reset --hard