-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99535d3
commit 0903726
Showing
11 changed files
with
195 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: PR Validation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint-commits: | ||
name: Lint Commits | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm install --no-package-lock | ||
|
||
- name: Validate all commits | ||
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: v3.12.3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/#-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm install -g semantic-release @semantic-release/exec @semantic-release/github @semantic-release/npm | ||
|
||
- name: Create package directory | ||
run: mkdir -p charts/dist | ||
|
||
- name: Run semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release | ||
|
||
- name: Package Helm chart | ||
if: ${{ env.RELEASE_VERSION != '' }} | ||
run: mkdir -p charts/dist && helm package charts/kubanana -d ./charts/dist | ||
|
||
- name: Set version from package.json | ||
id: get_version | ||
run: | | ||
PKG_VERSION=$(node -p "require('./package.json').version") | ||
echo "VERSION=v$PKG_VERSION" >> $GITHUB_OUTPUT | ||
echo "VERSION_NO_V=$PKG_VERSION" >> $GITHUB_OUTPUT | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: build/Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}/controller:${{ steps.get_version.outputs.VERSION }} | ||
ghcr.io/${{ github.repository }}/controller:latest | ||
- name: Push Helm chart to GHCR | ||
run: | | ||
# Get packaged chart file | ||
CHART_PACKAGE=$(ls ./charts/dist/kubanana-*.tgz | head -n 1) | ||
# Push Helm chart to GHCR | ||
helm push ${CHART_PACKAGE} oci://ghcr.io/${{ github.repository }}/charts | ||
# Output success message | ||
echo "Successfully pushed Helm chart to ghcr.io/${{ github.repository }}/charts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit ${1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# Run Go linting | ||
make analyze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "VERSION=v${nextRelease.version} VERSION_NO_V=${nextRelease.version} sed -i.bak -e \"s/appVersion: \\\".*\\\"/appVersion: \\\"v${nextRelease.version}\\\"/ ; s/version: .*/version: ${nextRelease.version}/\" charts/kubanana/Chart.yaml && sed -i.bak \"s/tag: \\\".*\\\"/tag: \\\"v${nextRelease.version}\\\"/\" charts/kubanana/values.yaml && rm -f charts/kubanana/Chart.yaml.bak charts/kubanana/values.yaml.bak", | ||
"publishCmd": "echo 'Version v${nextRelease.version} has been released'" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": [ | ||
{"path": "charts/dist/*.tgz", "label": "Helm Chart"} | ||
] | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'body-max-line-length': [0, 'always'], | ||
'footer-max-line-length': [0, 'always'] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "kubanana", | ||
"private": true, | ||
"version": "0.0.0-alpha", | ||
"description": "A Kubernetes controller that triggers jobs based on Kubernetes events", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/roshbhatia/kubanana.git" | ||
}, | ||
"author": "Roshan Bhatia", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/roshbhatia/kubanana/issues" | ||
}, | ||
"homepage": "https://github.com/roshbhatia/kubanana#readme", | ||
"devDependencies": { | ||
"@commitlint/cli": "^18.4.3", | ||
"@commitlint/config-conventional": "^18.4.3", | ||
"@semantic-release/exec": "^6.0.3", | ||
"@semantic-release/github": "^9.2.3", | ||
"@semantic-release/npm": "^11.0.2", | ||
"husky": "^8.0.3", | ||
"semantic-release": "^22.0.8" | ||
}, | ||
"scripts": { | ||
"prepare": "husky install" | ||
} | ||
} |