Skip to content

Minecraft version update #228

Minecraft version update

Minecraft version update #228

---
name: Minecraft version update
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
build:
name: Minecraft Version Update
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup Tools
run: |
brew install yq
# https://github.com/tyriis/bedrock-version-fetcher
- name: Fetch Bedrock Version
uses: tyriis/[email protected]
id: bedrock
- name: PrintBedrock Version
run: echo "Current Minecraft Bedrock version is ${{ steps.bedrock.outputs.version }}"
- name: Version Update
id: update
run: |
version=$(npx zx ./.github/scripts/minecraftVersionCheck.mjs \
--helm-release=./kubernetes/talos-flux/apps/gaming/minecraft-bedrock/app/helm-release.yaml \
--version=${{ steps.bedrock.outputs.version }})
echo "version<<EOF" >> "${GITHUB_OUTPUT}"
echo "${version}" >> "${GITHUB_OUTPUT}"
echo "EOF" >> "${GITHUB_OUTPUT}"
# https://github.com/marketplace/actions/install-gh-cli
- name: install github cli
if: "${{ steps.update.outputs.version != '' }}"
uses: dev-hanz-ops/[email protected]
# https://github.com/EndBug/add-and-commit
# - name: commit
# if: "${{ steps.update.outputs.version != '' }}"
# uses: EndBug/[email protected]
# with:
# add: kubernetes/talos-flux/apps/gaming/minecraft-bedrock/app/helm-release.yaml
# message: "chore(deps): update minecraft-bedrock to ${{ steps.update.outputs.version }}"
# new_branch: minecraft/bedrock-${{ steps.update.outputs.version }}
- name: commit
if: "${{ steps.update.outputs.version != '' }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_TO_COMMIT: kubernetes/talos-flux/apps/gaming/minecraft-bedrock/app/helm-release.yaml
DESTINATION_BRANCH: minecraft/bedrock-${{ steps.bedrock.outputs.version }}
MESSAGE: "chore(deps): update minecraft-bedrock to ${{ steps.bedrock.outputs.version }}"
run: |
gh api --method POST \
-H "Accept: application/vnd.github.v3+json" \
/repos/tyriis/home-ops/git/refs \
-f ref="refs/heads/$DESTINATION_BRANCH" \
-f sha="$(git rev-parse HEAD)"
git pull
export SHA=$( git rev-parse origin/$DESTINATION_BRANCH:$FILE_TO_COMMIT )
export CONTENT=$( base64 -i $FILE_TO_COMMIT )
gh api --method PUT /repos/${{ github.repository }}/contents/$FILE_TO_COMMIT \
--field message="$MESSAGE" \
--field content="$CONTENT" \
--field encoding="base64" \
--field branch="$DESTINATION_BRANCH" \
--field sha="$SHA"
# https://github.com/marketplace/actions/create-pull-request
- name: create pr
uses: peter-evans/[email protected]
if: ${{ steps.update.outputs.version != '' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: kubernetes/talos-flux/apps/gaming/minecraft-bedrock/app/helm-release.yaml
commit-message: "chore(deps): update minecraft bedrock to ${{ steps.bedrock.outputs.version }}"
branch: minecraft/bedrock-${{ steps.bedrock.outputs.version }}
base: main
title: "chore(deps): update minecraft bedrock to ${{ steps.bedrock.outputs.version }}"