mirror of
https://github.com/GeyserMC/GeyserOptionalPack.git
synced 2025-12-19 14:59:14 +00:00
Create build.yml
This commit is contained in:
48
.github/workflows/build.yml
vendored
Normal file
48
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- '.gitignore'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'README.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare pack
|
||||||
|
run: bash prepare_pack.sh
|
||||||
|
|
||||||
|
- name: Zip pack
|
||||||
|
run: zip GeyserOptionalPack.mcpack -r . -x ".*" Jenkinsfile required_files.txt prepare_pack.sh
|
||||||
|
|
||||||
|
|
||||||
|
- name: Publish to Downloads API
|
||||||
|
if: ${{ success() && github.repository == 'GeyserMC/GeyserOptionalPack' && github.ref_name == 'master' }}
|
||||||
|
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
|
||||||
|
# Set the project
|
||||||
|
project=geyseroptionalpack
|
||||||
|
# Get the version from gradle.properties
|
||||||
|
version=$(cat manifest.json | jq -r '.version | join(".")')
|
||||||
|
# Create the build folder
|
||||||
|
ssh -o StrictHostKeyChecking=no -i id_ecdsa $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP mkdir -p "~/uploads/$project/$GITHUB_RUN_NUMBER/"
|
||||||
|
# Copy over artifacts
|
||||||
|
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" GeyserOptionalPack.mcpack $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$project/$GITHUB_RUN_NUMBER/
|
||||||
|
# Run the build script
|
||||||
|
# Push the metadata
|
||||||
|
echo "{\"project\": \"$project\", \"version\": \"$version\", \"id\": $GITHUB_RUN_NUMBER, \"commit\": \"$GITHUB_SHA\"}" > metadata.json
|
||||||
|
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" metadata.json $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$project/$GITHUB_RUN_NUMBER
|
||||||
Reference in New Issue
Block a user