-
Notifications
You must be signed in to change notification settings - Fork 16
79 lines (72 loc) · 2.36 KB
/
cd.yml
File metadata and controls
79 lines (72 loc) · 2.36 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: CD
on:
push:
branches:
- main
- "v*"
- "workflow"
paths-ignore:
- "**.md"
workflow_dispatch:
inputs:
publish:
description: "Publish 🚀"
required: false
type: boolean
default: false
force-prerelease:
description: "Force Pre-release"
required: false
type: boolean
default: true
permissions:
id-token: write # required for OIDC
contents: write # required for tag push
packages: write # required for package publish
pull-requests: write # required for release PR creation
jobs:
publish:
name: Publish
if: |
contains(fromJSON('["main", "workflow"]'), github.ref_name) ||
startsWith(github.ref_name, 'v') ||
github.event.inputs.publish == 'true'
uses: sketch7/.github/.github/workflows/dotnet-publish.yml@dotnet-libs-v2
with:
force-preid: ${{ github.event.inputs.force-prerelease == 'true' }}
secrets:
nuget-auth-token: ${{ secrets.NUGET_KEY }}
prepare-release:
name: Prepare Release
needs: publish
# Only on push to main (not workflow branch, not manual dispatch, not stable branches)
if: |
needs.publish.result == 'success' &&
github.event_name == 'push' &&
github.ref_name == 'main'
uses: sketch7/.github/.github/workflows/prepare-release.yml@release-v1
with:
base-version: ${{ needs.publish.outputs.baseVersion }}
secrets:
token: ${{ secrets.GH_PAT }} # PAT with 'workflow' scope — required to create v* branches containing workflow files
release:
name: Release
needs: publish
# Only when a stable (non-prerelease) version was published — i.e. on push to v* branches
if: |
needs.publish.result == 'success' &&
!fromJSON(needs.publish.outputs.isPrerelease)
uses: sketch7/.github/.github/workflows/create-release.yml@release-v1
with:
version: ${{ needs.publish.outputs.version }}
bump-main:
name: Bump main
needs: [publish, release]
# After a stable release on the latest major — opens a PR bumping main's minor version
if: |
needs.release.result == 'success' &&
needs.release.outputs.is-latest == 'true' &&
github.event_name == 'push'
uses: sketch7/.github/.github/workflows/node-bump-main.yml@release-v1
with:
released-version: ${{ needs.publish.outputs.version }}