-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.82 KB
/
checker.yaml
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
83
84
85
name: update-checker
on:
workflow_dispatch:
env:
status: failure
workflow_name: none
apk-path: none
repo-title: none
jobs:
check_for_update:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Run Main.go
id: run-main
run: |
go run ./src/main.go --token="${{ secrets.GITHUB_TOKEN }}"
- name: Set Environment Variables
run: |
echo "status=$(jq -r '.status' data/info.json)" >> $GITHUB_ENV
echo "workflow_name=$(jq -r '.workflow.title' data/info.json)" >> $GITHUB_ENV
echo "repo-title=$(jq -r '.workflow.repo' data/settings.json)" >> $GITHUB_ENV
echo "apk-path=$(ls -S archive/*.apk | head -n 1)" >> $GITHUB_ENV
- name: Make Commit Log
run: |
echo "$(jq -r '.["commit-log"]' data/info.json)" > ./data/commit-log.txt
- name: Get Apk Info
id: apk-info
if: ${{ env.status == 'success' }}
uses: hkusu/apk-info-action@v1
with:
apk-path: ${{ env.apk-path }}
- name: Commit Changes
run: |
git config --global user.email "apk-artifacts-downloader@github.com"
git config --global user.name "${{ github.repository_owner }}"
git add .
git commit -m "Update ${{ env.repo-title }} to latest version"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.status == 'success' }}
- name: Publish Release
uses: softprops/action-gh-release@v2
if: ${{ env.status == 'success' }}
with:
files: ./archive/*.apk
tag_name: ${{ steps.apk-info.outputs.version-name }}
name: ${{ env.workflow_name }}
body_path: ./data/commit-log.txt
rerun-workflow:
name: Re-run workflow
needs: check_for_update
if: success() || failure()
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Wait for 5 minutes
run: |
elapsed_time=$(jq -r '.["elapsed-time"]' data/info.json)
if [ $elapsed_time -lt 300 ]; then
sleep $((300 - elapsed_time))
fi
- name: Re-trigger workflow
run: gh workflow run checker.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}