Release #5
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish_github: | |
| description: Publish to GitHub | |
| type: boolean | |
| default: true | |
| publish_curseforge: | |
| description: Publish to CurseForge | |
| type: boolean | |
| default: true | |
| publish_modrinth: | |
| description: Publish to Modrinth | |
| type: boolean | |
| default: true | |
| publish_maven: | |
| description: Publish to Maven | |
| type: boolean | |
| default: true | |
| publish_hexdoc: | |
| description: Publish hexdoc book | |
| type: boolean | |
| default: true | |
| dry_run: | |
| description: Perform a dry run | |
| type: boolean | |
| default: false | |
| env: | |
| PYPI_PACKAGE: hexdoc-hexal | |
| jobs: | |
| publish-mod: | |
| if: inputs.publish_github || inputs.publish_curseforge || inputs.publish_modrinth | |
| runs-on: ubuntu-latest | |
| env: | |
| DRY_RUN: ${{ inputs.dry_run && 'true' || '' }} | |
| environment: | |
| name: ${{ !inputs.dry_run && 'curseforge-modrinth' || '' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Build mod | |
| run: ./gradlew build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mod-build | |
| path: build/ciArtifacts/ | |
| if-no-files-found: error | |
| # do this first so we fail if we've already published this version | |
| - name: Publish to GitHub | |
| if: inputs.publish_github | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./gradlew publishGithub | |
| - name: Publish to CurseForge | |
| if: inputs.publish_curseforge | |
| env: | |
| CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | |
| run: ./gradlew publishCurseforge | |
| - name: Publish to Modrinth | |
| if: inputs.publish_modrinth | |
| env: | |
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
| run: ./gradlew publishModrinth | |
| - name: Upload dry run artifact | |
| if: inputs.dry_run | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dry-run | |
| path: '*/build/publishMods' | |
| if-no-files-found: error | |
| publish-maven: | |
| if: inputs.publish_maven | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ !inputs.dry_run && 'maven' || '' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Build mod | |
| run: ./gradlew build | |
| - name: Login to Azure | |
| if: inputs.dry_run == false | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| # https://learn.microsoft.com/en-us/azure/devops/artifacts/quickstarts/github-actions | |
| - name: Get Azure access token | |
| id: get-token | |
| if: inputs.dry_run == false | |
| run: | | |
| token=$(az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 --output tsv) | |
| echo "::add-mask::$token" | |
| echo "token=$token" >> "$GITHUB_OUTPUT" | |
| - name: Publish to ${{ inputs.dry_run && 'Maven Local' || 'Maven' }} | |
| env: | |
| MAVEN_PASSWORD: ${{ steps.get-token.outputs.token }} | |
| run: ./gradlew ${{ inputs.dry_run && 'publishToMavenLocal' || 'publish' }} | |
| - name: Upload dry run artifact | |
| if: inputs.dry_run | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: maven-dry-run | |
| path: ~/.m2/repository/ram/talia/hexal | |
| if-no-files-found: error | |
| publish-docs: | |
| if: inputs.publish_hexdoc | |
| uses: ./.github/workflows/docs.yml | |
| permissions: | |
| contents: write | |
| pages: read | |
| with: | |
| deploy-pages: ${{ !inputs.dry_run }} | |
| release: true | |
| publish-pypi: | |
| needs: publish-docs | |
| if: inputs.publish_hexdoc && !inputs.dry_run | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/${{ env.PYPI_PACKAGE }} | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: hexdoc-build | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |