forked from GeyserMC/Geyser
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger preview deploy on certain PRs
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Upload Preview | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
runId: | ||
required: true | ||
description: 'ID of the Build Pull Request Run' | ||
|
||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Download all artifacts' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
const run_id = ${{ github.event.inputs.runId }}; | ||
const artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: run_id, | ||
}); | ||
// Loop through all artifacts and download them | ||
for (const artifact of artifacts.data.artifacts) { | ||
const download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: artifact.id, | ||
archive_format: 'zip', | ||
}); | ||
const fs = require('fs'); | ||
// Write each artifact to a separate file named after the artifact | ||
fs.writeFileSync(`${{github.workspace}}/${artifact.name}.zip`, Buffer.from(download.data)); | ||
} | ||
- name: 'Unzip artifacts' | ||
run: | | ||
mkdir -p ${{github.workspace}}/artifacts | ||
for zip in ${{github.workspace}}/*.zip; do | ||
unzip -d ${{github.workspace}}/artifacts "$zip" | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,17 @@ 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/[email protected] | ||
with: | ||
script: | | ||
github.actions.createWorkflowDispatch({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
workflow_id: 'preview.yml', | ||
ref: 'master', | ||
inputs: { | ||
runId: '${{ github.run_id }}' | ||
} | ||
}); |