Repository navigation
103 lines (97 loc) · 3.15 KB
/
Copy pathrelease.yml
File metadata and controls
103 lines (97 loc) · 3.15 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: release
on:
push:
# release/v* picks up hand edits to an open release PR
branches: [main, 'release/v*']
pull_request:
types: [closed]
branches: [main]
# merged release PRs, publish reruns, and prereleases all arrive here
workflow_dispatch:
inputs:
prerelease:
description: 'Cut a prerelease instead of a normal release, e.g. `beta`, `rc`, or `0`'
required: false
default: ''
npm-tag:
description: 'npm dist-tag to publish to. Set by uppt/release for maintenance lines; leave blank otherwise'
required: false
default: ''
permissions: {}
jobs:
# open or update a draft release PR from conventional commits
pr:
if: |
!github.event.repository.fork
&& (
(
github.event_name == 'push'
&& (
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|| startsWith(github.ref, 'refs/heads/release/v')
)
) || (
github.event_name == 'workflow_dispatch'
&& !startsWith(github.ref, 'refs/tags/')
)
)
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: danielroe/uppt/pr@6ec27140623aa835e362f866d8ab0018ab057f4d # v0.6.11
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ inputs.prerelease }}
# release PR merged: tag it, cut a GitHub release, dispatch the publish run
release:
if: |
github.event_name == 'pull_request'
&& github.event.pull_request.merged == true
&& startsWith(github.event.pull_request.head.ref, 'release/v')
&& github.event.pull_request.head.repo.full_name == github.repository
&& !github.event.repository.fork
runs-on: ubuntu-latest
concurrency:
group: release-${{ github.event.pull_request.number }}
cancel-in-progress: false
permissions:
contents: write
actions: write
steps:
- uses: danielroe/uppt/release@6ec27140623aa835e362f866d8ab0018ab057f4d # v0.6.11
with:
token: ${{ secrets.GITHUB_TOKEN }}
# the chained dispatch lands here on the vX.Y.Z tag; build the tarball
pack:
if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
concurrency:
group: pack-${{ github.ref }}
cancel-in-progress: false
permissions: {}
outputs:
files: ${{ steps.pack.outputs.files }}
steps:
- id: pack
uses: danielroe/uppt/pack@6ec27140623aa835e362f866d8ab0018ab057f4d # v0.6.11
# stage the prebuilt tarball to npm via OIDC
publish:
if: |
github.event_name == 'workflow_dispatch'
&& startsWith(github.ref, 'refs/tags/v')
&& needs.pack.outputs.files != '[]'
needs: pack
runs-on: ubuntu-latest
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
permissions:
id-token: write
environment: npm
steps:
- uses: danielroe/uppt/publish@6ec27140623aa835e362f866d8ab0018ab057f4d # v0.6.11
with:
files: ${{ needs.pack.outputs.files }}
npm-tag: ${{ inputs.npm-tag }}