Skip to content

Commit

Permalink
chore: add github action to release chart
Browse files Browse the repository at this point in the history
  • Loading branch information
bougou committed Aug 30, 2024
1 parent e8b59aa commit 1634c46
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 64 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/build_and_push.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/release-charts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Release Charts

on:
push:
branches:
- "main"

jobs:

chart-release:
name: chart release
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3

- name: install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: run chart-releaser
uses: helm/[email protected]
with:
charts_dir: deploy/charts/alertmanager-webhook-adapter
skip_packaging: false
skip_existing: false
skip_upload: false
mask_as_latest: false
pages_branch: gh-pages
packages_with_index: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
66 changes: 58 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,81 @@
---
# Release files to GitHub Releases

name: Tagged Binary Release CI
name: Release

on:
push:
branches:
- "main"
tags:
- "v*"

jobs:
tagged-release:
name: Tagged Release
docker-release:
name: docker release
runs-on: ubuntu-latest

steps:
- uses: AutoModality/action-clean@v1

- uses: actions/checkout@v2

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: docker login
uses: docker/[email protected]
with:
# registry: ${{ secrets.DOCKERHUB_ADDR }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: prepare short tag
id: prepare_short_tag
run: |
SHORT_TAG=`git describe --abbrev=5 --dirty --tags --always`
echo "::set-output name=image_short_tag::$SHORT_TAG"
echo "::notice title=Build Image Short Tag::$SHORT_TAG"
- name: prepare tag
id: prepare_tag
run: |
TIME_TAG=`TZ=Zero date +"%y%m%d%H%M%S"`
COMMIT_TAG=`echo $GITHUB_SHA | cut -c 1-7`
TAG="$TIME_TAG-$COMMIT_TAG"
echo "::set-output name=image_tag::$TAG"
echo "::notice title=Build Image Tag::$TAG"
- name: build and push
uses: docker/build-push-action@v2
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: |
bougou/alertmanager-webhook-adapter:latest
bougou/alertmanager-webhook-adapter:${{ steps.prepare_tag.outputs.image_tag }}
bougou/alertmanager-webhook-adapter:${{ steps.prepare_short_tag.outputs.image_short_tag }}
binary-release:
name: binary release
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/v')

steps:
- uses: actions/checkout@v2
- name: Set up Go

- name: set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Build & test
- name: build & test
run: |
make dependencies
make build-all
- uses: marvinpinto/action-automatic-releases@latest
- name: release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ docker run --rm -it -p 127.0.0.1:8090:8090 bougou/alertmanager-webhook-adapter:v

### Run in K8S

```
Apply manifests:

```bash
cd deploy/k8s
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
Expand Down
4 changes: 2 additions & 2 deletions deploy/charts/alertmanager-webhook-adapter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
appVersion: 1.1.8
description: alertmanager webhook adapter
description: helm chart for alertmanager webhook adapter
name: alertmanager-webhook-adapter
version: 1.0.0
version: 1.0.1
type: application
maintainers:
- name: bougou
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ spec:
spec:
containers:
- name: webhook
image: bougou/alertmanager-webhook-adapter:v1.1.8
image: {{ .Values.image.name }}:{{ .Values.image.tag }}
command:
- /alertmanager-webhook-adapter
- --listen-address=:8090
- --signature={{ .Values.signature }}
- --tmpl-lang={{ .Values.lang | default "en" }}
env:
- name: TZ
value: Asia/Shanghai
value: {{ .Values.timezone }}
resources:
requests:
memory: 50Mi
Expand Down
6 changes: 5 additions & 1 deletion deploy/charts/alertmanager-webhook-adapter/values.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
signature: "MyIDC"
image:
name: bougou/alertmanager-webhook-adapter
tag: v1.1.8
signature: MyIDC
lang: en
timezone: Asia/Shanghai

0 comments on commit 1634c46

Please sign in to comment.