2024-04-18 14:29:40 +00:00
|
|
|
name: Upload Preview
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
runId:
|
|
|
|
required: true
|
|
|
|
description: 'ID of the action to pull artifacts from'
|
|
|
|
build:
|
|
|
|
required: true
|
|
|
|
description: 'Build number for the release'
|
|
|
|
version:
|
|
|
|
required: true
|
|
|
|
description: 'Version under which to upload to the Downloads API'
|
2024-04-20 01:47:00 +00:00
|
|
|
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
|
2024-04-18 14:29:40 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
upload:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2024-04-20 02:12:27 +00:00
|
|
|
PROJECT: 'geyserpreview'
|
2024-04-18 14:29:40 +00:00
|
|
|
steps:
|
2024-04-20 01:47:00 +00:00
|
|
|
- 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
|
2024-04-18 14:29:40 +00:00
|
|
|
with:
|
2024-04-20 01:47:00 +00:00
|
|
|
run-id: ${{ steps.setvars.outputs.RUN }}
|
2024-04-18 14:29:40 +00:00
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
merge-multiple: true
|
|
|
|
- name: Get Preview Metadata
|
|
|
|
if: success()
|
2024-04-20 01:47:00 +00:00
|
|
|
# See https://github.com/Kas-tle/base-release-action/releases/tag/main-11
|
|
|
|
uses: Kas-tle/base-release-action@664c39985eb9d0d393ce98e7eb8414d3d98e762a # main-11
|
2024-04-18 14:29:40 +00:00
|
|
|
with:
|
|
|
|
appID: ${{ secrets.RELEASE_APP_ID }}
|
|
|
|
appPrivateKey: ${{ secrets.RELEASE_APP_PK }}
|
|
|
|
files: |
|
|
|
|
bungeecord:Geyser-BungeeCord.jar
|
|
|
|
fabric:Geyser-Fabric.jar
|
|
|
|
neoforge:Geyser-NeoForge.jar
|
|
|
|
spigot:Geyser-Spigot.jar
|
|
|
|
standalone:Geyser-Standalone.jar
|
|
|
|
velocity:Geyser-Velocity.jar
|
|
|
|
viaproxy:Geyser-ViaProxy.jar
|
|
|
|
releaseEnabled: false
|
|
|
|
saveMetadata: true
|
|
|
|
updateReleaseData: false
|
|
|
|
- name: Update Generated Metadata
|
|
|
|
if: success()
|
|
|
|
run: |
|
|
|
|
cat metadata.json
|
|
|
|
echo
|
2024-04-28 14:43:33 +00:00
|
|
|
mv metadata.json metadata.json.tmp
|
|
|
|
jq --arg project "${PROJECT}" --arg version "${VERSION}" --arg number "${BUILD}" '
|
2024-04-18 14:29:40 +00:00
|
|
|
.
|
|
|
|
| .downloads |= map_values({"name", "sha256"})
|
|
|
|
| {$project, "repo", $version, "number": $number | tonumber, "changes": [], "downloads"}
|
2024-04-28 14:43:33 +00:00
|
|
|
' metadata.json.tmp > metadata.json
|
|
|
|
cat metadata.json
|
2024-04-18 14:29:40 +00:00
|
|
|
- name: Publish to Downloads API
|
|
|
|
if: success()
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
DOWNLOADS_USERNAME: ${{ vars.DOWNLOADS_USERNAME }}
|
|
|
|
DOWNLOADS_PRIVATE_KEY: ${{ secrets.DOWNLOADS_PRIVATE_KEY }}
|
|
|
|
DOWNLOADS_SERVER_IP: ${{ secrets.DOWNLOADS_SERVER_IP }}
|
|
|
|
run: |
|
|
|
|
# Save the private key to a file
|
|
|
|
echo "$DOWNLOADS_PRIVATE_KEY" > id_ecdsa
|
|
|
|
chmod 600 id_ecdsa
|
|
|
|
# Create the build folder
|
|
|
|
ssh -o StrictHostKeyChecking=no -i id_ecdsa $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP mkdir -p "~/uploads/$PROJECT/$BUILD/"
|
|
|
|
# Copy over artifacts
|
|
|
|
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" Geyser-*.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$BUILD/
|
|
|
|
# Run the build script
|
|
|
|
# Push the metadata
|
2024-04-18 16:18:05 +00:00
|
|
|
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" metadata.json $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$BUILD/
|