Skip to content

Make item store smarter #120

Make item store smarter

Make item store smarter #120

Workflow file for this run

name: Upload Artifacts and Notify Discord
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
- name: Build with Gradle
run: gradle clean build
- name: Upload JAR Artifact
id: upload-jar
uses: actions/upload-artifact@v4
with:
name: Aurora-${{ github.run_number }}
path: build/libs/Aurora-**.jar
- name: Get commit messages since last push
id: commits
run: |
echo "Fetching commits between ${{ github.event.before }} and ${{ github.sha }}"
commits_json=$(git log ${{ github.event.before }}..${{ github.sha }} --pretty=format:'{"sha": "%H", "message": "%s"},' | sed '$ s/,$//')
commits_base64=$(echo "[$commits_json]" | base64 -w 0)
echo "commits=$commits_base64" >> $GITHUB_OUTPUT
- name: Upload to server
run: |
commits_json=$(echo "${{ steps.commits.outputs.commits }}" | base64 --decode)
artifact_url="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ steps.upload-jar.outputs.artifact-id }}/zip"
json_payload=$(jq -n \
--arg secret "${{ secrets.SERVER_SECRET }}" \
--arg repo "${{ github.repository }}" \
--arg artifactUrl "$artifact_url" \
--argjson buildNumber ${{ github.run_number }} \
--arg branch "${{ github.ref_name }}" \
--argjson commits "$commits_json" \
'{
secret: $secret,
repo: $repo,
artifact_url: $artifactUrl,
build_number: $buildNumber,
branch: $branch,
commits: $commits
}')
curl -X POST ${{ secrets.SERVER_UPLOAD_URL }} -H "Content-Type: application/json" -d "$json_payload"