Plugin-bump-asf-reference #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
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 | |
git config -f .gitmodules submodule.ArchiSteamFarm.branch "$LATEST_ASF_RELEASE" | |
git add -A ".gitmodules" | |
if ! git diff --cached --quiet; then | |
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}" | |
fi | |
- name: Push changes to the repo | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ env.PUSH_GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |