-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.09 KB
/
sync-push.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
name: sync-push
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '17 1 * * *'
workflow_dispatch:
jobs:
get_commits:
runs-on: ubuntu-latest
outputs:
LOCAL: ${{ steps.commits.outputs.SETLOCAL }}
REMOTE: ${{ steps.commits.outputs.SETREMOTE }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: main
- name: set local and remote latest commit as environment variables
id: commits
run: |
touch main/.last_sync_id
echo "::set-output name=SETREMOTE::$(git ls-remote https://github.com/jlas1/Klicky-Probe.git HEAD | awk '{ print $1 }')"
echo "::set-output name=SETLOCAL::$(cat main/.last_sync_id)"
repo_sync:
needs: [get_commits]
runs-on: ubuntu-latest
if: needs.get_commits.outputs.LOCAL != needs.get_commits.outputs.REMOTE
steps:
- name: Checkout local
uses: actions/checkout@v3
with:
path: main
- name: Checkout upstream
uses: actions/checkout@v3
with:
repository: jlas1/Klicky-Probe
path: upstream
- name: Sync
run: |
rm -f main/*.cfg
cp -a upstream/Klipper_macros/*.cfg main/
- name: Update commit ID
run: echo ${{ needs.get_commits.outputs.REMOTE }} > main/.last_sync_id
- name: Commit and push the change
uses: stefanzweifel/git-auto-commit-action@latest
with:
repository: main
commit_message: Sync with upstream
- name: Cleanup repos
run: |
rm -rf upstream
rm -rf main
- name: Checkout local again
uses: actions/checkout@v3
- id: "tag"
uses: fregante/daily-version-action@v2
with:
prefix: v
- id: "build"
run: |
zip klicky_macros.zip *.cfg
- id: "release"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ steps.tag.outputs.version }}
prerelease: false
files: |
*.zip
LICENSE