[ref:add-cargo] Add cargo #1220
Workflow file for this run
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: Java CI with Gradle | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "*" ] | |
| workflow_call: | |
| inputs: | |
| version: | |
| default: ${{ github.run_number }} | |
| required: false | |
| type: string | |
| jobs: | |
| build: | |
| if: startsWith(github.event.head_commit.message, '[Skip]') == false | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Parse [ref title | |
| id: parseref | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[ref:') | |
| run: | | |
| prefixrm=$(echo "${{github.event.pull_request.title}}" | cut -c6-) | |
| BRANCHNAME=$(echo "$prefixrm" | cut -d']' -f1) | |
| git clone https://github.com/pylonmc/pylon-core.git | |
| cd pylon-core | |
| echo "CORECOMMIT=$(git rev-parse origin/$(echo "$BRANCHNAME"))" >> $GITHUB_ENV | |
| cd .. | |
| rm -rf pylon-core | |
| - name: Parse [commit title | |
| id: parsecommit | |
| if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[commit:') | |
| run: | | |
| prefixrm=$(echo "${{github.event.pull_request.title}}" | cut -c9-) | |
| echo "CORECOMMIT=$(echo "$prefixrm" | cut -d']' -f1)" >> $GITHUB_ENV | |
| - name: Get latest commit of core master | |
| if: steps.parseref.outcome == 'skipped' && steps.parsecommit.outcome == 'skipped' | |
| run: | | |
| git clone https://github.com/pylonmc/pylon-core.git | |
| cd pylon-core | |
| echo "CORECOMMIT=$(git rev-parse origin/master)" >> $GITHUB_ENV | |
| cd .. | |
| rm -rf pylon-core | |
| - name: Set up JDK 21 | |
| uses: actions/[email protected] | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/[email protected] | |
| - name: Clone master project | |
| run: | | |
| git clone https://github.com/pylonmc/pylon.git | |
| cd pylon | |
| ./gradlew | |
| cd pylon-core | |
| git fetch origin $(echo "$CORECOMMIT") | |
| git checkout $(echo "$CORECOMMIT") | |
| cd ../pylon-base | |
| git fetch origin ${{ github.sha }} | |
| git checkout ${{ github.sha }} | |
| - name: Build with Gradle Wrapper | |
| run: | | |
| cd pylon | |
| ./gradlew :pylon-base:shadowJar -Pversion=${{ inputs.version || github.run_number }} | |
| - name: Upload the artifact | |
| uses: actions/[email protected] | |
| with: | |
| name: pylon-base-${{ inputs.version || github.run_number }} | |
| path: 'pylon/pylon-base/build/libs/pylon-base-${{ inputs.version || github.run_number }}.jar' | |
| dependency-submission: | |
| needs: [build] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| - name: Set up JDK 21 | |
| uses: actions/[email protected] | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Generate and submit dependency graph | |
| uses: gradle/actions/[email protected] |