Skip to content

Commit

Permalink
update helm chart action
Browse files Browse the repository at this point in the history
  • Loading branch information
4nte committed Jul 12, 2023
1 parent 84f1c7c commit 21b5e2d
Showing 1 changed file with 50 additions and 73 deletions.
123 changes: 50 additions & 73 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,66 @@ name: Release with goreleaser
on:
push:
branches:
- "!*"
- "!*"
tags:
- "v*.*.*"
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
name: goreleaser
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- id: get_version
uses: battila7/get-version-action@v2
- run: echo ${{ steps.get_version.outputs.version-without-v }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
path: mqtt-mirror
fetch-depth: 0
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
path: mqtt-mirror
fetch-depth: 0

- name: Checkout helm package repository repo
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
repository: 4nte/helm-charts
path: helm-charts
ref: master
- name: Checkout helm package repository repo
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
repository: 4nte/helm-charts
path: helm-charts
ref: master

- name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: goreleaser
uses: goreleaser/goreleaser-action@v3
with:
args: release
workdir: ${{github.workspace}}/mqtt-mirror
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: goreleaser
uses: goreleaser/goreleaser-action@v3
with:
args: release
workdir: ${{github.workspace}}/mqtt-mirror
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Publish helm chart
uses: stefanprodan/[email protected]
with:
token: ${{ secrets.PAT }}
repository: charts
chart_version: ${{ steps.get_version.outputs.version-without-v }}
app_version: ${{ steps.get_version.outputs.version-without-v }}


- name: Create helm package
uses: stefanprodan/kube-tools@v1
with:
helm: 2.17.0
command: |
export SEMVER=${GITHUB_REF#refs/tags/v}
echo "-- here --"
pwd
ls
echo "-- GITHUB_WORKSPACE --"
ls $GITHUB_WORKSPACE
echo "-- GITHUB_WORKSPACE/helm-charts--"
ls $GITHUB_WORKSPACE/helm-charts
echo "-- GITHUB_WORKSPACE/mqtt-mirror--"
ls $GITHUB_WORKSPACE/mqtt-mirror
echo "-- Code repo ---"
helm init --client-only
mkdir -p $GITHUB_WORKSPACE/helm-charts/charts/mqtt-mirror
helm package $GITHUB_WORKSPACE/mqtt-mirror/chart/mqtt-mirror --destination $GITHUB_WORKSPACE/helm-charts/charts/mqtt-mirror --version $SEMVER
helm repo index $GITHUB_WORKSPACE/helm-charts --url https://4nte.github.io/helm-charts/
cd $GITHUB_WORKSPACE/helm-charts
echo "-- Helm repo ---"
ls
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "release helm chart" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT }}
repository: 4nte/helm-charts
directory: ${{github.workspace}}/helm-charts
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: master
github_token: ${{ secrets.PAT }}
repository: helm-charts
directory: ${{github.workspace}}/helm-charts

0 comments on commit 21b5e2d

Please sign in to comment.