Skip to content

Commit 005d0e1

Browse files
committed
fix: attempt to rework release please process
1 parent e695b96 commit 005d0e1

File tree

4 files changed

+236
-365
lines changed

4 files changed

+236
-365
lines changed

.github/release-please-config.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
"weave-gitops": {
5+
"release-type": "go",
6+
"changelog-path": "CHANGELOG.md",
7+
"version-file": "go.mod",
8+
"extra-files": [
9+
"package.json",
10+
"charts/gitops-server/Chart.yaml",
11+
"charts/gitops-server/values.yaml"
12+
],
13+
"bump-minor-pre-major": true,
14+
"include-v-in-tag": true,
15+
"extra-changelog-sections": [
16+
{
17+
"type": "feat",
18+
"section": "## 🚀 Enhancements"
19+
},
20+
{
21+
"type": "fix",
22+
"section": "## 🐛 Bug Fixes"
23+
},
24+
{
25+
"type": "docs",
26+
"section": "## 📖 Documentation"
27+
},
28+
{
29+
"type": "refactor",
30+
"section": "## 🔧 Refactoring"
31+
},
32+
{
33+
"type": "test",
34+
"section": "## 🧪 Testing"
35+
},
36+
{
37+
"type": "chore",
38+
"section": "## 🛠️ Maintenance",
39+
"hidden": true
40+
}
41+
],
42+
"pr-header": "chore",
43+
"package-name": "weave-gitops"
44+
}
45+
}
46+
}

.github/workflows/lint-pr.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/pr.yaml

Lines changed: 87 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
name: PR CI
2+
13
on:
24
push:
35
branches:
46
- main
7+
- fix/*
58
pull_request:
69
branches:
710
- main
@@ -12,13 +15,77 @@ concurrency:
1215
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1316

1417
permissions:
15-
contents: read # for actions/checkout to fetch code
18+
contents: read
1619

17-
name: PR CI Workflow
1820
jobs:
19-
ci-js:
20-
name: CI Test JS
21+
22+
lint-pr-title:
23+
name: Validate PR title
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
27+
id: lint_pr_title
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
32+
# When the previous steps fail, the workflow would stop. By adding this
33+
# condition you can continue the execution with the populated error message.
34+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
35+
with:
36+
header: pr-title-lint-error
37+
message: |
38+
Hey there and thank you for opening this pull request! :wave:
39+
40+
We require pull request titles to follow the
41+
[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/)
42+
and it looks like your proposed title needs to be adjusted.
43+
44+
We use the pull request title in automated release changelog updates, and would like our
45+
changelogs to look nice.
46+
47+
Details:
48+
49+
```
50+
${{ steps.lint_pr_title.outputs.error_message }}
51+
```
52+
53+
# Delete a previous comment when the issue has been resolved
54+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
55+
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
56+
with:
57+
header: pr-title-lint-error
58+
delete: true
59+
60+
61+
# Static analysis and code quality
62+
lint:
63+
name: Lint and format check
2164
runs-on: ubuntu-latest
65+
needs: lint-pr-title
66+
steps:
67+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
68+
- name: Setup Go
69+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
70+
with:
71+
go-version-file: go.mod
72+
- run: make check-format
73+
- run: make lint
74+
- run: go mod tidy
75+
- name: Verify go mod tidy
76+
run: git diff --no-ext-diff --exit-code
77+
- run: make proto
78+
- name: Verify proto generation
79+
run: git diff --no-ext-diff --exit-code
80+
- run: make fakes
81+
- name: Verify fakes generation
82+
run: git diff --no-ext-diff --exit-code
83+
84+
# Test JavaScript/UI
85+
test-js:
86+
name: Test JavaScript
87+
runs-on: ubuntu-latest
88+
needs: lint
2289
steps:
2390
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2491
- name: Setup Node.js
@@ -27,21 +94,20 @@ jobs:
2794
node-version-file: package.json
2895
cache: yarn
2996
- run: make node_modules
30-
- name: Check that package.json & package-lock.json were updated in commit
31-
run: |
32-
echo "Using node.js "$(node --version)
33-
echo "Using Yarn "$(yarn --version)
34-
git diff --no-ext-diff --exit-code
97+
- name: Verify package files
98+
run: git diff --no-ext-diff --exit-code
3599
- run: make ui-audit
36100
- run: make ui
37101
- run: make ui-lint
38102
- run: make ui-prettify-check
39103
- run: make ui-test
40104
- run: make ui-lib
41105

42-
ci-go:
43-
name: CI Test Go
106+
# Test Go code
107+
test-go:
108+
name: Test Go
44109
runs-on: ubuntu-latest
110+
needs: lint
45111
steps:
46112
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
47113
- name: Setup Go
@@ -52,130 +118,27 @@ jobs:
52118
uses: fluxcd/flux2/action@4a15fa6a023259353ef750acf1c98fe88407d4d0 # v2.7.2
53119
- run: make unit-tests
54120

55-
ci-static:
56-
name: CI Check Static Checks
57-
runs-on: ubuntu-latest
58-
steps:
59-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
60-
- name: Setup Go
61-
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
62-
with:
63-
go-version-file: go.mod
64-
- run: make check-format
65-
- run: make lint
66-
- run: go mod tidy
67-
- name: Check that go mod tidy has been run
68-
run: git diff --no-ext-diff --exit-code
69-
- run: make proto
70-
- name: Check that make proto has been run
71-
run: git diff --no-ext-diff --exit-code
72-
- run: make fakes
73-
- name: Check that make fakes has been run
74-
run: git diff --no-ext-diff --exit-code
75121

76-
build-push-image:
77-
name: CI Build Image
122+
# Build Docker images (but don't push on PRs)
123+
build-images:
124+
name: Build Docker Images
78125
uses: ./.github/workflows/build-push-image.yaml
126+
needs:
127+
- test-go
128+
- test-js
79129
with:
80130
file: ${{ matrix.docker-image }}.dockerfile
81131
image: ghcr.io/${{ github.repository }}/${{ matrix.docker-image }}
82-
push: ${{ github.event_name != 'pull_request' && github.repository == 'weaveworks/weave-gitops' }}
132+
push: ${{ github.event_name != 'pull_request' }}
83133
tags: |
84134
type=ref,event=branch
85135
type=ref,event=pr
86136
permissions:
87-
contents: read # for actions/checkout to fetch code
88-
id-token: write # for Cosign to be able to sign images with GHA token
89-
packages: write # for docker/build-push-action to push images
137+
contents: read
138+
id-token: write
139+
packages: write
90140
strategy:
91141
matrix:
92142
docker-image:
93143
- gitops
94144
- gitops-server
95-
96-
ci-upload-binary:
97-
name: Upload Binary - Disabled
98-
runs-on: ${{ matrix.os }}
99-
needs: [ci-go, ci-static, ci-js]
100-
strategy:
101-
matrix:
102-
os: [ubuntu-latest, macOS-latest]
103-
if: ${{ github.event_name != 'pull_request' && github.repository == 'weaveworks/weave-gitops' }}
104-
steps:
105-
- name: Checkout code
106-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
107-
- name: Setup Go
108-
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
109-
with:
110-
go-version-file: go.mod
111-
- name: Clean
112-
run: make clean
113-
- id: gitsha
114-
run: |
115-
gitsha=$(git rev-parse --short ${{ github.sha }})
116-
echo "sha=$gitsha" >> $GITHUB_OUTPUT
117-
- name: build
118-
run: |
119-
make gitops
120-
- name: Upload binary
121-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
122-
with:
123-
name: gitops-${{ matrix.os }}-${{ steps.gitsha.outputs.sha }}
124-
path: bin/gitops
125-
overwrite: true
126-
127-
ci-publish-js-lib:
128-
name: Publish js library
129-
runs-on: ubuntu-latest
130-
if: "${{ github.repository_owner == 'weaveworks' && github.ref_name == 'main'}}"
131-
needs: [ci-js]
132-
permissions:
133-
packages: write
134-
outputs:
135-
js-version: ${{ steps.package-version.outputs.js-version }}
136-
steps:
137-
- name: Checkout
138-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
139-
with:
140-
# avoid the merge commit that on.pull_request creates
141-
# fallback to github.sha if not present (e.g. on.push(main))
142-
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
143-
# We want the correct sha so we can tag the npm package correctly
144-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
145-
fetch-depth: 0
146-
- name: Setup Node.js
147-
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
148-
with:
149-
node-version-file: package.json
150-
registry-url: "https://npm.pkg.github.com"
151-
scope: "@weaveworks"
152-
- run: yarn
153-
- run: make ui-lib
154-
- name: Update package version
155-
id: package-version
156-
run: |
157-
GITOPS_VERSION=$(git describe)
158-
echo "js-version=$GITOPS_VERSION" >> $GITHUB_OUTPUT
159-
jq '.version = "'$GITOPS_VERSION'" | .name = "@weaveworks/weave-gitops-main"' < dist/package.json > dist/package-new.json
160-
mv dist/package-new.json dist/package.json
161-
cp .npmrc dist
162-
- run: cd dist && npm publish
163-
env:
164-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165-
166-
# release step updates 'release' status check for non releases branches. See ../../doc/incidents/issues-3907 for full context.
167-
release:
168-
if: ${{ github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'releases/') && !github.event.pull_request.head.repo.fork }}
169-
runs-on: ubuntu-latest
170-
steps:
171-
- name: Release
172-
run: |
173-
curl --fail --request POST \
174-
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
175-
--header 'authorization: Bearer ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }}' \
176-
--header 'content-type: application/json' \
177-
--data '{
178-
"state":"success",
179-
"description":"release not required",
180-
"context":"release"
181-
}'

0 commit comments

Comments
 (0)