-
-
Notifications
You must be signed in to change notification settings - Fork 134
131 lines (116 loc) · 3.97 KB
/
release-please.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
124
125
126
127
128
129
130
131
name: ' 🚀 Generate Release Please'
on:
workflow_dispatch:
push:
branches:
- main
permissions:
actions: read
checks: write
contents: write
issues: read
packages: write
pull-requests: write
repository-projects: read
statuses: read
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- name: Release Please Results
env:
RESULTS: ${{ toJSON(steps.release.outputs) }}
run: echo "$RESULTS"
- name: Checkout code
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v4
- name: tag versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/streetsidesoftware/vscode-spell-checker.git"
git tag -a v${{ steps.release.outputs.version }} -m "Release v${{ steps.release.outputs.version }}"
git push origin v${{ steps.release.outputs.version }}
result:
runs-on: ubuntu-latest
needs:
- release-please
steps:
- name: Summary Info
uses: streetsidesoftware/actions/public/summary@v1
with:
text: |
# Release Please Results
Release Created: ${{ needs.release-please.outputs.release_created || 'false' }}
Results:
```json
${{ toJSON(needs.release-please.outputs) }}
```
assets:
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/release-assets.yml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
mark-prerelease:
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/release-mark-prerelease.yml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
publish:
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/manual-publish.yml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
secrets:
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
label:
runs-on: ubuntu-latest
needs:
- release-please
if: ${{ !needs.release-please.outputs.release_created }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Find PR
id: find-pr
uses: actions/github-script@v7
with:
script: |
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: context.sha
});
const found = prs.filter(pr => pr.title.startsWith('chore(main): release code-spell-checker'))
return found[0]?.number || '';
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Mode
id: prerelease-mode
uses: ./.github/actions/is-prerelease
- name: Label PR
if: ${{ steps.find-pr.outputs.result }}
env:
LABEL_ADD: ${{ steps.prerelease-mode.outputs.prerelease == 'true' && 'Prerelease' || 'Release' }}
LABEL_REMOVE: ${{ steps.prerelease-mode.outputs.prerelease == 'true' && 'Release' || 'Prerelease' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.find-pr.outputs.result }} --add-label "$LABEL_ADD" --remove-label "$LABEL_REMOVE"