-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.49 KB
/
sync.yml
File metadata and controls
86 lines (75 loc) · 2.49 KB
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
name: Sync Upstream Chart
on:
schedule:
- cron: "0 6 * * 1" # weekly on monday
workflow_dispatch:
inputs:
upstream_ref:
description: "Upstream ref to sync (tag, branch, or SHA)"
default: "main"
permissions:
contents: write
pages: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Clone upstream code-server
run: |
git clone --depth 1 \
--branch "${{ github.event.inputs.upstream_ref || 'main' }}" \
https://github.com/coder/code-server.git /tmp/code-server
- name: Sync chart into charts/code-server
run: |
mkdir -p charts
rm -rf charts/code-server
cp -r /tmp/code-server/ci/helm-chart charts/code-server
- name: Apply local overrides
run: |
if [ -d overrides/code-server ]; then
cp -r overrides/code-server/* charts/code-server/
fi
- name: Record upstream version
run: |
cd /tmp/code-server
echo "$(git rev-parse HEAD) $(git describe --tags --always)" \
> "$GITHUB_WORKSPACE/charts/code-server/.upstream-ref"
- name: Commit changes
id: commit
run: |
git add charts/
if git diff --cached --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No changes detected"
else
CHART_VERSION=$(grep '^version:' charts/code-server/Chart.yaml | awk '{print $2}')
git commit -m "sync: code-server chart ${CHART_VERSION}"
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Tag release
run: |
CHART_VERSION=$(grep '^version:' charts/code-server/Chart.yaml | awk '{print $2}')
TAG="v${CHART_VERSION}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping"
else
git tag "$TAG"
git push origin "$TAG"
echo "Created and pushed tag $TAG"
fi
- name: Release charts
uses: helm/chart-releaser-action@v1.7.0
with:
charts_dir: charts
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"