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
name: Deploy to CurseForge | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Build with Maven | |
run: mvn clean package | |
- name: List target directory contents | |
run: ls -la target/ | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MX-MachinarIO-jar # O nome do artefato deve ser consistente | |
path: target/MX-MachinarIO-1.0.jar # Verifique o caminho correto | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: MX-MachinarIO-jar # O nome deve ser o mesmo do upload | |
- name: Set environment variables | |
run: | | |
echo "CURSEFORGE_API_TOKEN=${{ secrets.CURSEFORGE_API_TOKEN }}" >> $GITHUB_ENV | |
echo "PROJECT_ID=1119932" >> $GITHUB_ENV | |
- name: Upload to CurseForge | |
run: | | |
curl -X POST "https://minecraft.curseforge.com/api/projects/$PROJECT_ID/upload-file" \ | |
-H "X-Api-Token: $CURSEFORGE_API_TOKEN" \ | |
-F "file=@target/MX-MachinarIO-1.0.jar" \ | |
-F "metadata={\"changelog\": \"Atualizações do plugin\", \"releaseType\": \"release\", \"gameVersions\": [\"1.17\", \"1.18\"]}" |