Skip to content

Commit ff3daaa

Browse files
authored
fix: Fix tested platforms & Add publishing support (#519)
- Update tested platforms - Remove testing for CentOS 7 & Fedora - Add testing for CentOS Stream 9 & 10 - Add label workflow - Prevent users from changing metadata.rb and any workflow --------- Signed-off-by: Dan Webb <dan.webb@damacus.io>
1 parent e5ce767 commit ff3daaa

10 files changed

Lines changed: 228 additions & 6 deletions
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: CHANGELOG Unreleased Section
3+
4+
"on":
5+
push: {branches: [main]}
6+
7+
jobs:
8+
check-changelog:
9+
runs-on: ubuntu-latest
10+
name: Verify CHANGELOG.md has unreleased entries
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v5
15+
16+
- name: Extract and validate Unreleased section
17+
uses: actions/github-script@v7
18+
with:
19+
script: |
20+
const fs = require('fs');
21+
22+
// Read CHANGELOG.md
23+
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
24+
25+
// Split into lines
26+
const lines = changelog.split('\n');
27+
28+
// Find the "## Unreleased" section
29+
const unreleasedIndex = lines.findIndex(line => line.trim() === '## Unreleased');
30+
31+
if (unreleasedIndex === -1) {
32+
core.setFailed('❌ ERROR: Could not find "## Unreleased" section in CHANGELOG.md');
33+
return;
34+
}
35+
36+
// Find the next "## " section (next version)
37+
const nextSectionIndex = lines.findIndex((line, index) =>
38+
index > unreleasedIndex && line.match(/^## \d+\.\d+\.\d+/)
39+
);
40+
41+
// Extract content between sections
42+
const endIndex = nextSectionIndex === -1 ? lines.length : nextSectionIndex;
43+
const unreleasedLines = lines.slice(unreleasedIndex + 1, endIndex);
44+
45+
// Filter out empty lines and whitespace-only lines
46+
const contentLines = unreleasedLines.filter(line =>
47+
line.trim().length > 0
48+
);
49+
50+
console.log('Extracted unreleased content:');
51+
contentLines.forEach(line => console.log(line));
52+
console.log('---');
53+
54+
// Check if there's any actual content
55+
if (contentLines.length === 0) {
56+
core.setFailed('❌ ERROR: CHANGELOG.md "## Unreleased" section is empty or contains only blank lines\nPlease add at least one entry describing the changes in this release.');
57+
} else {
58+
console.log(`✅ SUCCESS: CHANGELOG.md "## Unreleased" section contains entries`);
59+
console.log(`Found ${contentLines.length} non-blank lines`);
60+
}

.github/workflows/ci.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: ci
2+
name: Dokken Integration Tests
33

44
"on":
55
pull_request:
@@ -27,9 +27,9 @@ jobs:
2727
- "debian-12"
2828
- "ubuntu-2004"
2929
- "ubuntu-2204"
30-
- "centos-stream-8"
3130
- "centos-stream-9"
32-
- "fedora-latest"
31+
# - "centos-stream-10" No candidate version available for pcre-devel
32+
# - "fedora-latest"
3333
suite:
3434
- config-2
3535
- config-3
@@ -102,7 +102,7 @@ jobs:
102102
strategy:
103103
matrix:
104104
os:
105-
- "centos-7"
105+
- "centos-stream-9"
106106
suite:
107107
- "source-lua"
108108
fail-fast: false
@@ -127,8 +127,7 @@ jobs:
127127
strategy:
128128
matrix:
129129
os:
130-
- "centos-7"
131-
- "centos-stream-8"
130+
- "centos-stream-9"
132131
suite:
133132
- "config-2"
134133
- "config-3"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Lint PR'
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- reopened
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: read
16+
steps:
17+
- uses: amannn/action-semantic-pull-request@v6
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/labels.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pull Request Labels
2+
on:
3+
pull_request:
4+
types: [opened, labeled, unlabeled, synchronize]
5+
jobs:
6+
label:
7+
name: Require Release Label
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
steps:
13+
- uses: mheap/github-action-required-labels@v5
14+
with:
15+
mode: exactly
16+
count: 1
17+
labels: |
18+
Release: Major
19+
Release: Minor
20+
Release: Patch
21+
Release: Skip
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Prevent file change
3+
4+
on:
5+
pull_request_target:
6+
branches: [main]
7+
8+
jobs:
9+
prevent-metadata-change:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
pull-requests: read
13+
steps:
14+
- name: Prevent metadata.rb file change
15+
uses: xalvarez/prevent-file-change-action@v2
16+
with:
17+
githubToken: ${{ secrets.GITHUB_TOKEN }}
18+
pattern: metadata.rb
19+
trustedAuthors: sous-chefs
20+
21+
prevent-workflow-change:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
pull-requests: read
25+
steps:
26+
- name: Prevent workflow file change
27+
uses: xalvarez/prevent-file-change-action@v2
28+
with:
29+
githubToken: ${{ secrets.GITHUB_TOKEN }}
30+
pattern: .github/workflows
31+
trustedAuthors: sous-chefs
32+
closePR: true
33+
allowNewFiles: false

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: release-please
3+
4+
"on":
5+
push:
6+
tags: ["v*.*.*"]
7+
branches: [main]
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
attestations: write
13+
id-token: write
14+
15+
jobs:
16+
release-please:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
release_created: ${{ steps.release.outputs.release_created }}
20+
tag_name: ${{ steps.release.outputs.tag_name }}
21+
upload_url: ${{ steps.release.outputs.upload_url }}
22+
steps:
23+
- uses: googleapis/release-please-action@v4
24+
id: release
25+
with:
26+
token: ${{ secrets.PORTER_GITHUB_TOKEN }}
27+
28+
- name: Checkout
29+
uses: actions/checkout@v5
30+
if: ${{ steps.release.outputs.release_created }}
31+
32+
- name: Upload cookbook as artifact
33+
if: ${{ steps.release.outputs.release_created }}
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: haproxy-cookbook-${{ steps.release.outputs.tag_name }}
37+
path: |
38+
.
39+
!.git/
40+
!.github/
41+
!.kitchen/
42+
!.vscode/
43+
!documentation/
44+
!.gitignore
45+
!test/
46+
!spec/
47+
retention-days: 90
48+
compression-level: 6
49+
50+
- name: Generate artifact attestation
51+
if: ${{ steps.release.outputs.release_created }}
52+
uses: actions/attest-build-provenance@v1
53+
with:
54+
subject-name: haproxy-cookbook-${{ steps.release.outputs.tag_name }}
55+
56+
publish-to-supermarket:
57+
needs: release-please
58+
if: ${{ needs.release-please.outputs.release_created }}
59+
runs-on: ubuntu-latest
60+
container:
61+
image: chef/chefworkstation:latest
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v5
65+
66+
- name: Configure Chef credentials
67+
run: |
68+
mkdir -p ~/.chef
69+
echo "${{ secrets.CHEF_SUPERMARKET_KEY }}" > ~/.chef/supermarket.pem
70+
chmod 600 ~/.chef/supermarket.pem
71+
72+
- name: Publish to Chef Supermarket
73+
run: |
74+
knife supermarket share haproxy \
75+
--supermarket-site https://supermarket.chef.io \
76+
--key ~/.chef/supermarket.pem \
77+
--user-name ${{ secrets.CHEF_SUPERMARKET_USER }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ This file is used to list changes made in each version of the haproxy cookbook.
44

55
## Unreleased
66

7+
- Remove testing for CentOS 7 & Fedora
8+
- Add testing for CentOS Stream 9 & 10
9+
710
## 12.4.1 - *2025-09-04*
811

912
## 12.4.0 - *2024-12-09*

release-please-config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"releaseType": "ruby",
3+
"changelogPath": "CHANGELOG.md",
4+
"versionFile": "version.rb",
5+
"includeComponentInTag": false
6+
}

release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "12.4.1"
3+
}

version.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = '12.4.1'.freeze

0 commit comments

Comments
 (0)