Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Fix Preview Workflow (#4583)
* Fix preview workflow * Correct path to artifacts * Uncomment repo checks * Don't enforce repo/branch on preview deploy * Correct paths-ignore for build
Dieser Commit ist enthalten in:
Ursprung
94f664ad8d
Commit
525a9ccec4
@ -1,13 +1,27 @@
|
||||
name: Build Pull Request
|
||||
name: Build Remote
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
workflow_call:
|
||||
inputs:
|
||||
repository:
|
||||
required: true
|
||||
description: 'The repo of the remote'
|
||||
type: string
|
||||
ref:
|
||||
required: true
|
||||
description: 'The ref of the remote'
|
||||
type: string
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set Build Number
|
||||
run: |
|
||||
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up JDK 17
|
||||
# See https://github.com/actions/setup-java/commits
|
||||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
||||
@ -15,29 +29,12 @@ jobs:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Check if the author has forked the API repo
|
||||
# See https://github.com/Kas-tle/find-forks-action/commits
|
||||
uses: Kas-tle/find-forks-action@1b5447d1e3c7a8ed79583dd817cc5399686eed3a
|
||||
id: find_forks
|
||||
with:
|
||||
owner: GeyserMC
|
||||
repo: api
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Use author's API repo if it exists
|
||||
if: ${{ steps.find_forks.outputs.target_branch_found == 'true' }}
|
||||
env:
|
||||
API_FORK_URL: ${{ steps.find_forks.outputs.user_fork_url }}
|
||||
API_FORK_BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
run: |
|
||||
git clone "${API_FORK_URL}" --single-branch --branch "${API_FORK_BRANCH}" api
|
||||
cd api
|
||||
./gradlew publishToMavenLocal
|
||||
|
||||
- name: Checkout repository and submodules
|
||||
# See https://github.com/actions/checkout/commits
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
with:
|
||||
repository: ${{ inputs.repository }}
|
||||
ref: ${{ inputs.ref }}
|
||||
submodules: recursive
|
||||
path: geyser
|
||||
|
||||
@ -46,11 +43,12 @@ jobs:
|
||||
uses: gradle/wrapper-validation-action@699bb18358f12c5b78b37bb0111d3a0e2276e0e2 # v2.1.1
|
||||
|
||||
- name: Build Geyser
|
||||
# See https://github.com/gradle/gradle-build-action/commits
|
||||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 from https://github.com/gradle/actions/commits
|
||||
# See https://github.com/gradle/actions/commits
|
||||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
|
||||
with:
|
||||
arguments: build
|
||||
build-root-directory: geyser
|
||||
cache-read-only: true
|
||||
|
||||
- name: Archive artifacts (Geyser Fabric)
|
||||
# See https://github.com/actions/upload-artifact/commits
|
||||
@ -102,21 +100,3 @@ jobs:
|
||||
name: Geyser ViaProxy
|
||||
path: geyser/bootstrap/viaproxy/build/libs/Geyser-ViaProxy.jar
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Trigger Preview Deployment
|
||||
if: >-
|
||||
contains(github.event.pull_request.labels.*.name, 'PR: Needs Testing')
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
||||
with:
|
||||
script: |
|
||||
github.rest.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'preview.yml',
|
||||
ref: 'master',
|
||||
inputs: {
|
||||
runId: '${{ github.run_id }}',
|
||||
build: '${{ github.run_number }}',
|
||||
version: 'pr.${{ github.event.pull_request.number }}'
|
||||
}
|
||||
});
|
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@ -7,8 +7,9 @@ on:
|
||||
- 'gh-readonly-queue/**'
|
||||
paths-ignore:
|
||||
- '.github/ISSUE_TEMPLATE/*.yml'
|
||||
- '.github/actions/pullrequest.yml'
|
||||
- '.github/actions/preview.yml'
|
||||
- '.github/actions/workflows/build-remote.yml'
|
||||
- '.github/actions/workflows/preview.yml'
|
||||
- '.github/actions/workflows/pull-request.yml'
|
||||
- '.idea/copyright/*.xml'
|
||||
- '.gitignore'
|
||||
- 'CONTRIBUTING.md'
|
||||
@ -23,6 +24,13 @@ jobs:
|
||||
env:
|
||||
PROJECT: 'geyser'
|
||||
steps:
|
||||
- name: Set Build Number
|
||||
env:
|
||||
BUILD_JSON: ${{ vars.RELEASEACTION_PREVRELEASE }}
|
||||
run: |
|
||||
BUILD_NUMBER=$(echo $BUILD_JSON | jq --arg branch "${GITHUB_REF_NAME}" 'if .[$branch] == null then 1 else .[$branch] | .t | tonumber + 1 end // 1')
|
||||
echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout repository and submodules
|
||||
# See https://github.com/actions/checkout/commits
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
@ -40,8 +48,8 @@ jobs:
|
||||
distribution: temurin
|
||||
|
||||
- name: Build
|
||||
# See https://github.com/gradle/gradle-build-action/commits
|
||||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 from https://github.com/gradle/actions/commits
|
||||
# See https://github.com/gradle/actions/commits
|
||||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
|
||||
with:
|
||||
arguments: build
|
||||
gradle-home-cache-cleanup: true
|
||||
@ -108,7 +116,8 @@ jobs:
|
||||
|
||||
- name: Get Release Metadata
|
||||
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
|
||||
uses: Kas-tle/base-release-action@b863fa0f89bd15267a96a72efb84aec25f168d4c # https://github.com/Kas-tle/base-release-action/releases/tag/main-11
|
||||
# See https://github.com/Kas-tle/base-release-action/releases/tag/main-11
|
||||
uses: Kas-tle/base-release-action@b863fa0f89bd15267a96a72efb84aec25f168d4c # main-11
|
||||
with:
|
||||
appID: ${{ secrets.RELEASE_APP_ID }}
|
||||
appPrivateKey: ${{ secrets.RELEASE_APP_PK }}
|
||||
@ -134,6 +143,7 @@ jobs:
|
||||
| .downloads |= map_values({"name", "sha256"})
|
||||
| {$project, "repo", $version, "number": .build, "changes", "downloads"}
|
||||
' | tee metadata.json
|
||||
echo
|
||||
- name: Publish to Downloads API
|
||||
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
|
||||
shell: bash
|
||||
|
33
.github/workflows/preview.yml
vendored
33
.github/workflows/preview.yml
vendored
@ -12,23 +12,44 @@ on:
|
||||
version:
|
||||
required: true
|
||||
description: 'Version under which to upload to the Downloads API'
|
||||
workflow_call:
|
||||
inputs:
|
||||
build:
|
||||
required: true
|
||||
description: 'Build number for the release'
|
||||
type: string
|
||||
version:
|
||||
required: true
|
||||
description: 'Version under which to upload to the Downloads API'
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PROJECT: 'geyserpreview'
|
||||
BUILD: ${{ github.event.inputs.build }}
|
||||
VERSION: ${{ github.event.inputs.version }}
|
||||
PROJECT: 'geyser-preview'
|
||||
steps:
|
||||
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # https://github.com/actions/download-artifact/releases/tag/v4.1.4
|
||||
- name: Set Variables
|
||||
id: setvars
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||
echo "BUILD=${{ github.event.inputs.build }}" >> $GITHUB_ENV
|
||||
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
||||
echo "RUN=${{ github.event.inputs.runId }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "BUILD=${{ inputs.build }}" >> $GITHUB_ENV
|
||||
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
|
||||
echo "RUN=${{ github.run_id }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427
|
||||
with:
|
||||
run-id: ${{ github.event.inputs.runId }}
|
||||
run-id: ${{ steps.setvars.outputs.RUN }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
merge-multiple: true
|
||||
- name: Get Preview Metadata
|
||||
if: success()
|
||||
uses: Kas-tle/base-release-action@b863fa0f89bd15267a96a72efb84aec25f168d4c # https://github.com/Kas-tle/base-release-action/releases/tag/main-11
|
||||
# See https://github.com/Kas-tle/base-release-action/releases/tag/main-11
|
||||
uses: Kas-tle/base-release-action@664c39985eb9d0d393ce98e7eb8414d3d98e762a # main-11
|
||||
with:
|
||||
appID: ${{ secrets.RELEASE_APP_ID }}
|
||||
appPrivateKey: ${{ secrets.RELEASE_APP_PK }}
|
||||
|
24
.github/workflows/pull-request.yml
vendored
Normale Datei
24
.github/workflows/pull-request.yml
vendored
Normale Datei
@ -0,0 +1,24 @@
|
||||
name: Process Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Forbid access to secrets nor GH Token perms while building the PR
|
||||
permissions: {}
|
||||
secrets: {}
|
||||
uses: ./.github/workflows/build-remote.yml
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
preview:
|
||||
needs: [build]
|
||||
if: >-
|
||||
contains(github.event.pull_request.labels.*.name, 'PR: Needs Testing')
|
||||
# Allow access to secrets if we are uploading a preview
|
||||
secrets: inherit
|
||||
uses: ./.github/workflows/preview.yml
|
||||
with:
|
||||
build: ${{ github.run_number }}
|
||||
version: pr.${{ github.event.pull_request.number }}
|
@ -98,7 +98,7 @@ configure<BlossomExtension> {
|
||||
}
|
||||
|
||||
fun Project.buildNumber(): Int =
|
||||
(System.getenv("GITHUB_RUN_NUMBER") ?: jenkinsBuildNumber())?.let { Integer.parseInt(it) } ?: -1
|
||||
(System.getenv("BUILD_NUMBER"))?.let { Integer.parseInt(it) } ?: -1
|
||||
|
||||
inner class GitInfo {
|
||||
val branch: String
|
||||
@ -131,9 +131,6 @@ inner class GitInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// todo remove this when we're not using Jenkins anymore
|
||||
fun jenkinsBuildNumber(): String? = System.getenv("BUILD_NUMBER")
|
||||
|
||||
// Manual task to download the bedrock data files from the CloudburstMC/Data repository
|
||||
// Invoke with ./gradlew :core:downloadBedrockData --suffix=1_20_70
|
||||
// Set suffix to the current Bedrock version
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren