-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
1 changed file
with
50 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |