Skip to content

Plugin-bump-asf-reference #10

Plugin-bump-asf-reference

Plugin-bump-asf-reference #10

# 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