This commit extends the versions github workflow to automatically update jsonnet dependencies when the jsonnet code in upstream repositories changes.
50 lines
1.8 KiB
YAML
50 lines
1.8 KiB
YAML
name: Upgrade to latest versions
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '37 13 * * *'
|
|
jobs:
|
|
versions:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16
|
|
- name: Upgrade versions
|
|
run: |
|
|
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
|
# Write to temporary file to make update atomic
|
|
scripts/generate-versions.sh > /tmp/versions.json
|
|
mv /tmp/versions.json jsonnet/kube-prometheus/versions.json
|
|
- name: Install jsonnet bundler
|
|
run: |
|
|
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
|
|
- name: Update jsonnet dependencies
|
|
run: |
|
|
jb update
|
|
make --always-make generate
|
|
|
|
# Reset jsonnetfile.lock.json if no dependencies were updated
|
|
changedFiles=$(git diff --name-only | grep -v 'jsonnetfile.lock.json')
|
|
if [[ $changedFiles == "" ]]; then
|
|
git checkout -- jsonnetfile.lock.json;
|
|
fi
|
|
- name: Create Pull Request
|
|
uses: peter-evans/create-pull-request@v3
|
|
with:
|
|
commit-message: "[bot] Automated version update"
|
|
title: "[bot] Automated version update"
|
|
body: |
|
|
This is an automated version and jsonnet dependencies update performed from CI on behalf of @paulfantom.
|
|
|
|
Configuration of the workflow is located in `.github/workflows/versions.yaml`
|
|
team-reviewers: kube-prometheus-reviewers
|
|
labels: kind/enhancement
|
|
branch: automated-updates
|
|
delete-branch: true
|
|
# GITHUB_TOKEN cannot be used as it won't trigger CI in a created PR
|
|
# More in https://github.com/peter-evans/create-pull-request/issues/155
|
|
# TODO(paulfantom) Consider running this from a special bot account.
|
|
token: ${{ secrets.PAT }}
|