-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (38 loc) · 1.38 KB
/
ci.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: Update File Hash
on:
schedule:
- cron: '0 * * * *' # runs hourly at midnight UTC
workflow_dispatch: # so it can run manually
repository_dispatch:
types:
- discordo-ci-completed # Triggered by another repository's GitHub Actions
jobs:
update-hash:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download ZIP file
run: |
curl -L -O https://nightly.link/ayn2op/discordo/workflows/ci/main/discordo_Windows_X64.zip
- name: Calculate hash of ZIP file
id: calculate-hash
run: |
HASH=$(sha256sum discordo_Windows_X64.zip | awk '{ print $1 }')
echo "HASH=$HASH" >> $GITHUB_ENV
- name: Update hash in JSON file
run: |
jq --arg hash "$HASH" '.hash = $hash' bucket/discordo.json > tmp.json && mv tmp.json bucket/discordo.json
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --exit-code bucket/discordo.json; then
git add bucket/discordo.json
git commit -m "Update hash in discordo.json"
git push
else
echo "No changes to commit."
fi