CI Test #39
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: CI | |
on: | |
push: | |
branches: | |
- 'dev/**' | |
- 'exp/**' | |
paths: | |
- '*.gradle' | |
- 'gradle.properties' | |
- 'src/**' | |
- 'versions/**' | |
- '.github/**' | |
release: | |
types: | |
- published | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
target_subproject: | |
description: |- | |
The subproject name(s) of the specified Minecraft version to be released, seperated with ",". | |
By default all subprojects will be released. | |
type: string | |
required: false | |
default: '' | |
target_release_tag: | |
description: The tag of the release you want to append the artifact to. | |
type: string | |
required: true | |
jobs: | |
show_action_parameters: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Show action parameters | |
run: | | |
cat <<EOF > $GITHUB_STEP_SUMMARY | |
## Action Parameters | |
- target_subproject: \`${{ github.event.inputs.target_subproject }}\` | |
- target_release_tag: \`${{ github.event.inputs.target_release_tag }}\` | |
EOF | |
# Ensure the input target subproject is valid. | |
validate_target_subproject: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Make build summary | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
# ubuntu-22.04 uses Python 3.10.6 | |
run: python3 .github/workflows/scripts/validate_target_subproject.py | |
env: | |
TARGET_SUBPROJECT: ${{ inputs.target_subproject }} | |
# Ensure the input release tag is valid. | |
validate_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get github release information | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
uses: cardinalby/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
tag: ${{ github.event.inputs.target_release_tag }} | |
prepare_build_info: | |
if: ${{ !startsWith(github.event.ref, 'refs/tags/') }} | |
runs-on: ubuntu-latest | |
needs: | |
- validate_target_subproject | |
- validate_release | |
outputs: | |
build_type: ${{ steps.build_type.outputs.version_type }} | |
build_publish: ${{ steps.build_type.outputs.build_publish }} | |
steps: | |
- name: Checkout the sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Determining build type | |
id: build_type | |
run: | | |
if [ ${{ github.event_name }} == 'push' ] | |
then | |
echo 'build_publish=true' >> $GITHUB_OUTPUT | |
echo 'version_type=BETA' >> $GITHUB_OUTPUT | |
elif [ ${{ github.event_name }} == 'release' ] | |
then | |
echo 'build_publish=true' >> $GITHUB_OUTPUT | |
echo 'version_type=RELEASE' >> $GITHUB_OUTPUT | |
elif [ ${{ github.event_name }} == 'pull_request' ] | |
then | |
echo 'build_publish=false' >> $GITHUB_OUTPUT | |
echo 'version_type=PULL_REQUEST' >> $GITHUB_OUTPUT | |
elif [ ${{ github.event_name }} == 'workflow_dispatch' ] | |
then | |
echo 'build_publish=true' >> $GITHUB_OUTPUT | |
echo 'version_type=RELEASE' >> $GITHUB_OUTPUT | |
else | |
echo Unknown github event name $GITHUB_EVENT_NAME | |
exit 1 | |
fi | |
- name: Determining subprojects | |
run: python3 .github/workflows/scripts/subprojects.py | |
- name: Read Properties mod info | |
id: mod_info | |
uses: christian-draeger/[email protected] | |
with: | |
path: gradle.properties | |
properties: 'mod.name mod.version' | |
build: | |
if: ${{ contains(github.event.head_commit.message, '[build skip]') == false }} | |
needs: | |
- prepare_build_info | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
with: | |
build_type: ${{ needs.prepare_build_info.outputs.build_type }} | |
publish: | |
if: ${{ needs.prepare_build_info.outputs.build_publish == 'true' }} | |
needs: | |
- prepare_build_info | |
- build | |
uses: ./.github/workflows/publish.yml | |
secrets: inherit | |
with: | |
build_type: ${{ needs.prepare_build_info.outputs.build_type }} |