-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (97 loc) · 2.94 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
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 }}
publish-docs:
permissions:
contents: write
needs: release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
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]"
- name: Fetch origin
run: git fetch origin
- name: Checkout gh-pages
run: git checkout gh-pages
- name: Checkout docs from the current branch
run: git checkout ${{ github.ref }} -- docs
- name: Add docs
run: git add docs
- name: Check for changes
id: check_changes
run: |
if git diff --cached --exit-code; then
echo "No changes to commit"
echo "changes=false" >> $GITHUB_ENV
else
echo "changes=true" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.changes == 'true'
run: |
git commit -m "Copy docs from ${{ github.ref }}"
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}