-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (81 loc) · 3.57 KB
/
minecraft-version-update.yaml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.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: print the bedrock veesion
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/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 }}"