Skip to content

Thu Aug 15 19:36:32 UTC 2024: create/update new build workflow(s) #9

Thu Aug 15 19:36:32 UTC 2024: create/update new build workflow(s)

Thu Aug 15 19:36:32 UTC 2024: create/update new build workflow(s) #9

name: 'TeaCon 甲辰 | Guide Me To | To boldly go'
on:
push:
paths:
- '.github/workflows/mod-team-guide-me-to.yaml'
- 'mods/team-guide-me-to/HEAD'
workflow_dispatch:
inputs:
commit:
description: 'The commit hash you wish to build.'
required: false
type: string
jobs:
publish:
name: 'Build Guide Me To'
environment: Build
runs-on: ubuntu-22.04
env:
BILUOCHUN_URL: https://biluochun.teacon.cn
CONTEST_SEQ: '3'
CONTEST_SLUG: JC
CONTEST_TITLE: 'TeaCon 甲辰'
TEAM_ID: 'guide-me-to'
TEAM_SEQ: '334'
steps:
- name: Checkout Build Environment
uses: actions/checkout@v4
# Setup Microsoft JDK build. This should be the one used by official Minecraft Launcher.
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '21'
- name: Apply Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys:
${{ runner.os }}-gradle-
# We cannot use action/checkout@v2 because it does not support non-GitHub repositroy.
# The clone logic used here is adapted from https://stackoverflow.com/a/3489576 for
# sake of a faster build.
- name: 'Checkout Repository for Build Guide Me To'
shell: bash
run: |
mkdir -p build/repo
cd build/repo
git init
git remote add origin `cat ../../mods/team-guide-me-to/remote`
git fetch --depth=1 origin `cat ../../mods/team-guide-me-to/HEAD` || { echo '::error::Git 仓库检出失败,请检查仓库是否可公开访问!'; exit -1; }
git reset --hard `cat ../../mods/team-guide-me-to/HEAD`
git submodule init
git submodule update
[ -f build.gradle ] || [ -f build.gradle.kts ] || { echo '::error::Git 仓库检出疑似失败,请检查碧螺春中分支名是否正确!'; exit -1; }
- name: Validate Gradle Wrapper
id: gradle_wrapper_check
continue-on-error: true
uses: gradle/actions/wrapper-validation@v3
with:
min-wrapper-count: 1
- name: Artifact Building
id: building
shell: bash
env:
GRADLE_WRAPPER_CHECK: ${{ steps.gradle_wrapper_check.outcome == 'success' }}
GITHUB_USERNAME: 'teacon-bot[bot]'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cd build && ./build.sh
# We need at least Python 3.11 to ensure existence of tomllib (see PEP 680)
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Mod Description File Validation
id: description
shell: bash
run: ./build/mods_toml.py
- name: Prepare for Dedicated Server Launching Test
id: dedicated_server_launching_setup
shell: bash
env:
BILUOCHUN_TOKEN: ${{ secrets.BILUOCHUN_TOKEN }}
run: cd build && ./pre-server-test.sh
- name: Dedicated Server Launching Test
id: dedicated_server_launching
uses: teaconmc/dedicated-launch-test@1.21-neoforge
with:
extra: build/all-deps.json
mod: ${{ steps.building.outputs.artifact }}
- name: Publish
id: publication
shell: bash
env:
CONTEST_ID: JC
BILUOCHUN_TOKEN: ${{ secrets.BILUOCHUN_TOKEN }}
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
# https://github.com/aws/aws-cli/issues/5623
AWS_EC2_METADATA_DISABLED: 'true'
run: cd build && ./publish.sh
- name: Failure notification
id: failure_notification
if: failure()
shell: bash
env:
BILUOCHUN_TOKEN: ${{ secrets.BILUOCHUN_TOKEN }}
run: cd build && ./failure-callback.sh
# Change this counter to trigger all mod rebuild