feat(helm): add custom selector labels on ServiceMonitor #320
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
types: | |
- labeled | |
jobs: | |
release: | |
if: github.event.action != 'labeled' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bump version on merging Pull Requests with specific labels | |
id: bumpr | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
uses: haya14busa/action-bumpr@v1 | |
- name: Update corresponding major and minor tag | |
uses: haya14busa/action-update-semver@v1 | |
if: "!steps.bumpr.outputs.skip" | |
with: | |
tag: ${{ steps.bumpr.outputs.next_version }} | |
- name: Get tag name | |
id: tag | |
uses: haya14busa/action-cond@v1 | |
with: | |
cond: "${{ startsWith(github.ref, 'refs/tags/') }}" | |
if_true: ${{ github.ref }} | |
if_false: ${{ steps.bumpr.outputs.next_version }} | |
- id: version_tag | |
run: echo "::set-output name=tag::$(echo ${{steps.tag.outputs.value}} | cut -c 2-)" | |
# Update version in Chart.yaml | |
- if: steps.tag.outputs.value != '' | |
run: | | |
sed -i '/^version:/c\version: ${{steps.version_tag.outputs.tag}}' ./helm/prescaling-exporter/Chart.yaml | |
sed -i '/^appVersion:/c\appVersion: "${{steps.version_tag.outputs.tag}}"' ./helm/prescaling-exporter/Chart.yaml | |
- if: steps.tag.outputs.value != '' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "ci: bump charts to ${{steps.version_tag.outputs.tag}}" | |
- name: Create release | |
uses: shogo82148/actions-create-release@v1 | |
if: "steps.tag.outputs.value != ''" | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ steps.tag.outputs.value }} | |
release_name: Release ${{ steps.tag.outputs.value }} | |
body: ${{ steps.bumpr.outputs.message }} | |
draft: false | |
prerelease: false | |
- uses: actions/setup-go@v4 | |
if: "steps.tag.outputs.value != ''" | |
with: | |
go-version: '>=1.18.0' | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: "steps.tag.outputs.value != ''" | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{ secrets.DOCKER_AUTH_TOKEN }} | |
- uses: imjasonh/[email protected] | |
- name: Build and Push on Docker Hub | |
if: "steps.tag.outputs.value != ''" | |
env: | |
KO_DOCKER_REPO: bedrockstreaming/prescaling-exporter | |
run: ko publish . --bare --tags latest,${{steps.version_tag.outputs.tag}} | |
release-helm: | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: 'main' | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
charts_dir: helm | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
release-check: | |
if: github.event.action == 'labeled' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Post bumpr status comment | |
uses: haya14busa/action-bumpr@v1 |