Publish #20
This file contains hidden or 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: Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish_curseforge: | |
| description: 'Publish to CurseForge' | |
| type: boolean | |
| default: true | |
| publish_modrinth: | |
| description: 'Publish to Modrinth' | |
| type: boolean | |
| default: true | |
| publish_github_release: | |
| description: 'Create GitHub release' | |
| type: boolean | |
| default: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Make Gradle wrapper executable | |
| run: chmod +x gradlew | |
| - name: Build Simulated jar | |
| run: | | |
| git clone --depth 1 https://github.com/Creators-of-Aeronautics/Simulated-Project.git ../Simulated-Project | |
| chmod +x ../Simulated-Project/gradlew | |
| (cd ../Simulated-Project && ./gradlew :simulated:neoforge:jar --no-daemon) | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Publish | |
| env: | |
| CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | |
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tasks=() | |
| [ "${{ inputs.publish_curseforge }}" = "true" ] && tasks+=("publishCurseforge") | |
| [ "${{ inputs.publish_modrinth }}" = "true" ] && tasks+=("publishModrinth") | |
| [ "${{ inputs.publish_github_release }}" = "true" ] && tasks+=("publishGithub") | |
| if [ ${#tasks[@]} -eq 0 ]; then | |
| echo "No publish targets selected; skipping." | |
| exit 0 | |
| fi | |
| ./gradlew "${tasks[@]}" |