Skip to content

Commit 7362e0c

Browse files
authored
chore: refactor Updatecli workflow execution (#41)
Signed-off-by: Olivier Vernin <olivier@vernin.me>
1 parent c5c9692 commit 7362e0c

File tree

5 files changed

+76
-23
lines changed

5 files changed

+76
-23
lines changed

.github/workflows/updatecli.yaml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
1-
name: updatecli
1+
name: Updatecli
22
on:
3+
release:
34
workflow_dispatch:
4-
push:
5-
pull_request:
65
schedule:
7-
# * is a special character in YAML so you have to quote this string
8-
# Run every hour
9-
- cron: '0 * * * *'
6+
# Run at 12:00 every Saterday every 14 days
7+
- cron: "0 12 */14 * 6"
108
jobs:
119
updatecli:
1210
runs-on: ubuntu-latest
1311
steps:
1412
- name: "Checkout"
15-
uses: "actions/checkout@v3"
13+
uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6.0.1
1614
- name: "Setup updatecli"
17-
uses: "updatecli/updatecli-action@v2"
18-
- name: "Run updatecli in dryrun"
19-
run: "updatecli compose diff"
20-
env:
21-
GITHUB_ACTOR: ${{ github.actor }}
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
24-
id: generate_token
25-
if: github.ref == 'refs/heads/main'
15+
uses: "updatecli/updatecli-action@b846825b298f5351abd80f94c4f9eab63a38a804" # v2.98.0
2616
with:
27-
app-id: ${{ secrets.UPDATECLIBOT_APP_ID }}
28-
private-key: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }}
17+
version: "v0.113.0"
2918
- name: "Run updatecli"
30-
if: github.ref == 'refs/heads/main'
31-
run: "updatecli compose apply"
19+
run: updatecli compose apply --clean-git-branches=true --experimental
3220
env:
33-
GITHUB_ACTOR: ${{ secrets.UPDATECLI_BOT_GITHUB_ACTOR }}
34-
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
21+
UPDATECLI_GITHUB_APP_CLIENT_ID: ${{ secrets.UPDATECLIBOT_APP_ID }}
22+
UPDATECLI_GITHUB_APP_PRIVATE_KEY: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }}
23+
UPDATECLI_GITHUB_APP_INSTALLATION_ID: ${{ secrets.UPDATECLIBOT_APP_INSTALLATION_ID }}
24+
UPDATECLI_UDASH_API_URL: ${{ secrets.UPDATECLI_UDASH_API_URL }}
25+
UPDATECLI_UDASH_ACCESS_TOKEN: ${{ secrets.UPDATECLI_UDASH_ACCESS_TOKEN }}
26+
UPDATECLI_UDASH_URL: ${{ secrets.UPDATECLI_UDASH_URL }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Updatecli Test
3+
on:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
jobs:
8+
updatecli:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: "Checkout"
12+
uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6.0.1
13+
- name: "Setup updatecli"
14+
uses: "updatecli/updatecli-action@b846825b298f5351abd80f94c4f9eab63a38a804" # v2.98.0
15+
with:
16+
version: "v0.113.0"
17+
- name: "Test updatecli in dry-run mode"
18+
run: "updatecli compose diff"
19+
env:
20+
# This step is executed in untrusted context. We use a GitHub token with minimal permissions.
21+
GITHUB_ACTOR: ${{ github.actor }}
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Updatecli - Update
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run daily at 03:00
7+
- cron: "0 3 * * *"
8+
push:
9+
branches:
10+
- main
11+
jobs:
12+
updatecli:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: "Checkout"
16+
uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6.0.1
17+
- name: "Setup updatecli"
18+
uses: "updatecli/updatecli-action@b846825b298f5351abd80f94c4f9eab63a38a804" # v2.98.0
19+
with:
20+
version: "v0.113.0"
21+
- name: "Run updatecli only on existing pipelines"
22+
run: updatecli compose apply --clean-git-branches=true --existing-only=true --experimental
23+
env:
24+
UPDATECLI_GITHUB_APP_CLIENT_ID: ${{ secrets.UPDATECLIBOT_APP_ID }}
25+
UPDATECLI_GITHUB_APP_PRIVATE_KEY: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }}
26+
UPDATECLI_GITHUB_APP_INSTALLATION_ID: ${{ secrets.UPDATECLIBOT_APP_INSTALLATION_ID }}
27+
UPDATECLI_UDASH_API_URL: ${{ secrets.UPDATECLI_UDASH_API_URL }}
28+
UPDATECLI_UDASH_ACCESS_TOKEN: ${{ secrets.UPDATECLI_UDASH_ACCESS_TOKEN }}
29+
UPDATECLI_UDASH_URL: ${{ secrets.UPDATECLI_UDASH_URL }}

updatecli-compose.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ policies:
33
policy: ghcr.io/updatecli/policies/updatecli/autodiscovery:0.7.0@sha256:6890c4b4093a80063f518101881098fab8211c986481641faaf797a9ad5a31c3
44
values:
55
- updatecli/values.d/scm.yaml
6-
- name: Update Helm charts
6+
7+
- name: Update Helm Charts
78
policy: ghcr.io/updatecli/policies/autodiscovery/helm:0.8.0@sha256:2c14bf324ee0a548ec627b607c118fb27c74b72c4a330fc4e1bc35147593553f
89
values:
910
- updatecli/values.d/scm.yaml
11+
12+
- name: Update GitHub Actions
13+
policy: ghcr.io/updatecli/policies/autodiscovery/githubaction:0.3.0@sha256:3b5425da2a2a2b89bb69463f1294704c33730358c66140efb93cab14b2868b06
14+
values:
15+
- updatecli/values.d/scm.yaml
16+
- updatecli/values.d/githubaction.yaml
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
spec:
2+
digest: true
3+
rootdir: '.github'

0 commit comments

Comments
 (0)