-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (99 loc) · 3.54 KB
/
release.yaml
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
name: Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
repository-projects: read
# only required for workflows in private repositories
actions: read
concurrency:
group: release
jobs:
# This job creates the necessary labels for the release-please PRs
label-check:
name: Create release-please PR labels
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add labels to the repository if not present
env:
GH_TOKEN: ${{ github.token }}
run: |
gh label create "autorelease: pending" -c FBCA04 -d "release-please PR tagging - Pending release" || true
gh label create "autorelease: tagged" -c D4C5F9 -d "release-please PR tagging - Ready for release" || true
gh label create "autorelease: snapshot" -c D4C5F9 -d "release-please PR tagging - Ready for release" || true
gh label create "autorelease: published" -c 0E8A16 -d "release-please PR tagging - Released" || true
prerelease-prep:
name: Create Prerelease Pull Request
needs: label-check
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
name: Run prerelease release-please
uses: googleapis/release-please-action@v4
with:
config-file: ".github/prerelease-config.json"
manifest-file: ".github/prerelease-manifest.json"
prerelease-test:
name: Run Prerelease Tests
runs-on: ubuntu-latest
if: ${{ needs.prerelease-prep.outputs.releases_created == 'false' }}
needs: prerelease-prep
steps:
- name: End To End Test
run: |
echo "Running end to end tests for prerelease!"
prerelease:
name: Create Prerelease and Release Pull Request
runs-on: ubuntu-latest
if: ${{ needs.prerelease-prep.outputs.releases_created == 'true' && contains(needs.prerelease-prep.outputs.tag_name, 'rc') }}
needs: prerelease-prep
steps:
- name: Pre Release Step
run: |
echo "Running pre-release step!"
- name: Run release release-please
uses: googleapis/release-please-action@v4
with:
config-file: ".github/release-config.json"
manifest-file: ".github/release-manifest.json"
release:
name: Create Release
runs-on: ubuntu-latest
if: ${{ needs.prerelease-prep.outputs.releases_created == 'true' && !contains(needs.prerelease-prep.outputs.tag_name, 'rc') }}
needs: prerelease-prep
steps:
- name: Release Step
run: |
echo "Running release step!"
- name: Checkout
uses: actions/checkout@v4
- name: Sync prerelease manifest
env:
MANIFEST_PATH: .github/prerelease-manifest.json
RELEASE_TAG: ${{ needs.prerelease-prep.outputs.tag_name }}
run: |
jq --arg tag "${RELEASE_TAG//v/}" '.["."] = $tag' $MANIFEST_PATH > temp.json \
&& mv temp.json $MANIFEST_PATH
- name: Commit change
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add . $MANIFEST_PATH
git commit -m "chore: sync release manifests"
git push
post-release:
name: Run Release Build Push Deploy
runs-on: ubuntu-latest
needs: release
steps:
- name: Post Release Step
run: |
echo "Running post release step!"