fix: cleaner workflow for tag release #356
This file contains hidden or 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: CI | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
tags: | |
- 'ggscout-*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
HELM_CACHE_HOME: /tmp/helm-cache/ | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jdx/mise-action@v2 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
- run: pre-commit run --show-diff-on-failure --color=always --all-files | |
shell: bash | |
release: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- uses: jdx/mise-action@v2 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
env: | |
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
skip_existing: true | |
- name: Copy folder to target branch | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git fetch origin | |
git checkout gh-pages | |
git checkout ${{ github.ref }} -- docs | |
git add docs | |
git commit -m "Copy docs from ${{ github.ref }}" | |
git push origin gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |