Minecraft version update #136
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
--- | |
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@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | |
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: Version Update | |
id: update | |
run: | | |
version=$(npx zx ./.github/scripts/minecraftVersionCheck.mjs \ | |
--helm-release=./kubernetes/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}" | |
echo "${version}" | |
# 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/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/apps/gaming/minecraft-bedrock/app/helm-release.yaml | |
DESTINATION_BRANCH: minecraft/bedrock-${{ steps.update.outputs.version }} | |
MESSAGE: "chore(deps): update minecraft-bedrock to ${{ steps.update.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/apps/gaming/minecraft-bedrock/app/helm-release.yaml | |
commit-message: "chore(deps): update minecraft bedrock to ${{ steps.update.outputs.version }}" | |
branch: minecraft/bedrock-${{ steps.update.outputs.version }} | |
base: main | |
title: "chore(deps): update minecraft bedrock to ${{ steps.update.outputs.version }}" |