Fix refined storage build issues #583
  
    
      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: Build and Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| jobs: | |
| generate-artifact-name: | |
| runs-on: self-hosted | |
| outputs: | |
| name: ${{ steps.name.outputs.name }} | |
| steps: | |
| - name: Generate Name | |
| id: name | |
| run: | | |
| if [[ "${{ github.event_name }}" == 'pull_request' ]]; then | |
| suffix="PR ${{ github.event.number }}" | |
| else | |
| ref="${{ github.ref }}" | |
| ref="${ref#refs/heads/}" | |
| suffix="${ref//\//-}" | |
| fi | |
| name="AdvancedPeripherals $suffix" | |
| echo "name: $name" | |
| echo "name=$name" >> "$GITHUB_OUTPUT" | |
| build-and-test: | |
| needs: | |
| - generate-artifact-name | |
| uses: IntelligenceModding/actions/.github/workflows/build-and-test.yaml@master | |
| with: | |
| build_name: ${{ needs.generate-artifact-name.outputs.name }} | |
| pr: ${{ github.event_name == 'pull_request' && github.event.number || '' }} | |
| check: ${{ github.event_name != 'push' }} | |
| java-version: '' | |
| publish: | |
| if: ${{ github.event_name == 'push' && contains(github.ref, 'release/') }} | |
| runs-on: self-hosted | |
| needs: | |
| - build-and-test | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'microsoft' | |
| cache: 'gradle' | |
| java-version: '17' | |
| java-version-file: '.tool-versions' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Download Builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.build-and-test.outputs.artifact-name }} | |
| path: build/libs | |
| - name: Patch Changelog | |
| run: ./gradlew patchChangelog | |
| - name: Push Changelog Patch | |
| run: | | |
| git config user.name github-actions && \ | |
| git config user.email github-actions[bot]@users.noreply.github.com && \ | |
| git add CHANGELOG.md && \ | |
| git commit -m 'action: patchChangelog' && \ | |
| git push | |
| - name: Publish Maven | |
| env: | |
| PUBLIC_REP_NAME: ${{ secrets.PUBLIC_REP_NAME }} | |
| PUBLIC_REP_KEY: ${{ secrets.PUBLIC_REP_KEY }} | |
| run: ./gradlew publishAllPublicationsToPublicRepository | |
| - name: Github Release | |
| env: | |
| GITHUB_KEY: ${{ github.token }} | |
| run: ./gradlew githubRelease | |
| - name: Publish Modrinth | |
| env: | |
| MODRINTH_KEY: ${{ secrets.MODRINTH_KEY }} | |
| run: ./gradlew modrinth | |
| - name: Publish CurseForge | |
| env: | |
| CURSEFORGE_KEY: ${{ secrets.CURSEFORGE_KEY }} | |
| run: ./gradlew publishCurseForge |