-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (42 loc) · 1.41 KB
/
update.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
name: Build and test by Gradle
on:
schedule:
- cron: '0 0 1 * *'
pull_request:
branches: [ "*" ]
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Initialize branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}"
git fetch
git checkout main
git push origin --delete gh-actions-update || true
git checkout -b gh-actions-update
- name: Update tzot.json
run: docker compose up --build update
- name: Commit and push if new version found
run: |
set -eux
if [ -n "$(git diff)" ]; then
TZ_VERSION=$(cat gen/version)
git commit -am "Update tzot.json (${TZ_VERSION})"
git push
fi
- name: Create PR if new update found
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
if [ -n "$(git diff)" ]; then
TZ_VERSION=$(cat gen/version)
gh pr create --title "Update tzot.json (${TZ_VERSION})" --body "Update tzot.json (${TZ_VERSION})" --base main --head gh-actions-update
fi