-
-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (60 loc) · 3.07 KB
/
bump-asf-reference.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
# This action is responsible for automatically bumping the ArchiSteamFarm submodule reference to the latest stable release
# Please note that this DOES NOT update the actual commit the submodule itself is binded to, as that part is the responsibility of the developer or chosen dependencies management tool (such as Renovate or Dependabot), that will actually build and test whether the plugin project requires any kind of corrections before doing so
# Because of that, commit created through this workflow can't possibly create any kind of build regression, as we only limit the actual commit the above action can actually update to
# Note: If you'd like to change the default channel from stable to pre-releases, simply change RELEASE_TYPE
name: Plugin-bump-asf-reference
on:
schedule:
- cron: '17 1 * * *'
workflow_dispatch:
env:
# You can specify your own credentials if you'd like to, simply change ARCHIBOT_GPG_PRIVATE_KEY and/or ARCHIBOT_GITHUB_TOKEN secrets here to the ones you want to use
GPG_PRIVATE_KEY: ${{ secrets.ARCHIBOT_GPG_PRIVATE_KEY }} # Optional, if secret not provided, will skip signing commit with GPG key
PUSH_GITHUB_TOKEN: ${{ secrets.ARCHIBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} # Optional, if secret not provided, will use the default token
RELEASE_TYPE: stable # Recommended to choose one from: stable (latest ASF stable release), nodraft (latest ASF release, including pre-releases, but without drafts)
permissions:
contents: write
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
show-progress: false
token: ${{ env.PUSH_GITHUB_TOKEN }}
- name: Fetch latest ArchiSteamFarm release
id: asf-release
uses: rez0n/[email protected]
env:
repository: JustArchiNET/ArchiSteamFarm
token: ${{ secrets.GITHUB_TOKEN }}
type: ${{ env.RELEASE_TYPE }}
- name: Import GPG key for signing
uses: crazy-max/[email protected]
if: ${{ env.GPG_PRIVATE_KEY != null }}
with:
gpg_private_key: ${{ env.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Update ASF reference if needed
env:
LATEST_ASF_RELEASE: ${{ steps.asf-release.outputs.release }}
shell: sh
run: |
set -eu
current_version="$(git config -f .gitmodules submodule.ArchiSteamFarm.branch)"
if dpkg --compare-versions "$current_version" "ge" "$LATEST_ASF_RELEASE"; then
exit
fi
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config -f .gitmodules submodule.ArchiSteamFarm.branch "$LATEST_ASF_RELEASE"
git add -A ".gitmodules"
if ! git config --get user.email > /dev/null; then
git config --local user.email "[email protected]"
fi
if ! git config --get user.name > /dev/null; then
git config --local user.name "GitHub Action"
fi
git commit -m "Automatic ArchiSteamFarm reference update to ${LATEST_ASF_RELEASE}"
git push