Skip to content

Commit 7f046be

Browse files
authored
Merge pull request #1 from terralist/ci/add-workflows
CI: add workflows PR validation and release creation
2 parents ef9dd41 + 1a14b5f commit 7f046be

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: pull-request-validation
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- feature/pr-action
8+
9+
jobs:
10+
build_lint_validate_diff:
11+
name: lint, validate and diff from main
12+
permissions: write-all
13+
runs-on: ubuntu-latest
14+
container:
15+
image: alpine/helm:3.18.4
16+
steps:
17+
- name: checkout pr head
18+
uses: actions/checkout@v4.2.2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: install chart dependencies
23+
run: helm dependency build charts/terralist
24+
25+
- name: lint helm chart
26+
run: helm lint charts/terralist --set terralist.persistence.library.existingClaim=test-pvc
27+
28+
- name: prepare
29+
run: mkdir -p charts/terralist/build
30+
- name: create full manifest from pr head
31+
run: helm template terralist charts/terralist --set terralist.persistence.library.existingClaim=test-pvc | tee charts/terralist/build/manifest.yaml
32+
33+
- name: checkout main
34+
uses: actions/checkout@v4.2.2
35+
with:
36+
fetch-depth: 0
37+
ref: main
38+
path: main
39+
40+
- name: install chart dependencies
41+
run: helm dependency build main/charts/terralist
42+
43+
- name: prepare
44+
run: mkdir -p main/charts/terralist/build
45+
- name: create full manifest from main
46+
run: helm template terralist main/charts/terralist --set terralist.persistence.library.existingClaim=test-pvc | tee main/charts/terralist/build/manifest.yaml
47+
48+
- name: create diff comment
49+
uses: int128/diff-action@v1.55.0
50+
with:
51+
base: main/charts/terralist/build
52+
head: charts/terralist/build
53+
comment-header: "## Changes in Final Manifest"

.github/workflows/release.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
permissions: write-all
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@v4.2.2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: configure git
19+
run: |
20+
git config user.name "$GITHUB_ACTOR"
21+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
22+
23+
- name: get latest release
24+
id: version
25+
run: |
26+
tag=$(curl -s https://api.github.com/repos/terralist/terralist/releases/latest | jq '.tag_name' -r)
27+
chart_version=$(yq '.version' charts/terralist/Chart.yaml)
28+
if [[ "$chart_version" != "${tag#terralist-}" ]]; then
29+
echo "should_release=true" >> $GITHUB_OUTPUT
30+
else
31+
echo "should_release=false" >> $GITHUB_OUTPUT
32+
fi
33+
34+
- name: run chart-releaser
35+
id: cr
36+
if: ${{ steps.version.outputs.should_release == 'true' }}
37+
uses: helm/chart-releaser-action@v1.8.1
38+
env:
39+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
40+
CR_GENERATE_RELEASE_NOTES: true
41+
CR_SKIP_EXISTING: true
42+
43+
- name: Login to GitHub Container Registry
44+
if: ${{ steps.version.outputs.should_release == 'true' }}
45+
uses: docker/login-action@3.4.0
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.repository_owner }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- if: ${{ steps.version.outputs.should_release == 'true' }}
52+
name: Push Chart
53+
run: helm push .cr-release-packages/terralist-*.tgz oci://ghcr.io/${{ github.repository }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
CI: add workflows PR validation and release creation
1112

1213
### Changed
1314

0 commit comments

Comments
 (0)