2.0.0-rc.16 #77
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: Release Artifacts | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag to build for (e.g., 1.4.0)' | |
| required: true | |
| jobs: | |
| # Build native riddlc binaries on each target platform | |
| native-build: | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write | |
| packages: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| artifact: riddlc-macos-arm64 | |
| arch: arm64 | |
| - os: ubuntu-latest | |
| artifact: riddlc-linux-x86_64 | |
| arch: x86_64 | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set Up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: temurin | |
| cache: sbt | |
| - name: Set Up SBT | |
| uses: sbt/setup-sbt@7e33f738678e47369c83dcb4b1d9c65d66eb3cdd # v1 | |
| - name: Coursier Caching | |
| uses: coursier/cache-action@v7 | |
| - name: Configure sbt GitHub Packages credentials | |
| run: | | |
| mkdir -p ~/.sbt/2 | |
| cat > ~/.sbt/2/github.sbt << 'CREDSEOF' | |
| credentials += Credentials( | |
| "GitHub Package Registry", | |
| "maven.pkg.github.com", | |
| "x-access-token", | |
| sys.env.getOrElse("GITHUB_TOKEN", "") | |
| ) | |
| CREDSEOF | |
| - name: Install LLVM and Clang (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y clang llvm | |
| - name: Install curl dev dependencies (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev libidn2-dev | |
| - name: Build Native Binary | |
| run: sbt riddlcNative/nativeLink | |
| - name: Package Native Binary | |
| run: | | |
| mkdir -p staging/bin | |
| cp target/out/native0.5/scala-3.9.0-RC4/riddlc/riddlc staging/bin/riddlc | |
| cd staging && zip -r ../${{ matrix.artifact }}.zip bin/ | |
| - name: Upload to Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}" | |
| gh release upload "$TAG" "${{ matrix.artifact }}.zip" --clobber | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| retention-days: 30 | |
| path: ${{ matrix.artifact }}.zip | |
| # Build JVM version (universal, runs on any platform with JDK) | |
| jvm-build: | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write | |
| packages: read | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set Up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: temurin | |
| cache: sbt | |
| - name: Set Up SBT | |
| uses: sbt/setup-sbt@7e33f738678e47369c83dcb4b1d9c65d66eb3cdd # v1 | |
| - name: Coursier Caching | |
| uses: coursier/cache-action@v7 | |
| - name: Configure sbt GitHub Packages credentials | |
| run: | | |
| mkdir -p ~/.sbt/2 | |
| cat > ~/.sbt/2/github.sbt << 'CREDSEOF' | |
| credentials += Credentials( | |
| "GitHub Package Registry", | |
| "maven.pkg.github.com", | |
| "x-access-token", | |
| sys.env.getOrElse("GITHUB_TOKEN", "") | |
| ) | |
| CREDSEOF | |
| - name: Build and Stage JVM Version | |
| run: | | |
| sbt riddlc/stage | |
| cd target/out/jvm/scala-3.9.0-RC4/riddlc/universal/stage && zip -r "$GITHUB_WORKSPACE/riddlc.zip" bin/ lib/ | |
| - name: Upload to Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}" | |
| gh release upload "$TAG" riddlc.zip --clobber | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: riddlc-jvm | |
| retention-days: 30 | |
| path: riddlc.zip | |
| # Notify homebrew-tap to update formula with new SHA256 hashes | |
| update-homebrew: | |
| needs: [native-build, jvm-build] | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| path: artifacts | |
| - name: Compute SHA256 hashes | |
| id: hashes | |
| run: | | |
| echo "macos_arm64=$(shasum -a 256 artifacts/riddlc-macos-arm64/riddlc-macos-arm64.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" | |
| echo "linux_x86=$(shasum -a 256 artifacts/riddlc-linux-x86_64/riddlc-linux-x86_64.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" | |
| echo "jvm=$(shasum -a 256 artifacts/riddlc-jvm/riddlc.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" | |
| # A release candidate updates a SEPARATE formula. `gh release create --prerelease` | |
| # still fires this same `release: [created]` workflow, so without routing on | |
| # `prerelease` an RC would overwrite the stable formula and `brew install riddlc` | |
| # would serve a release candidate. Homebrew has no prerelease flag and its `devel` | |
| # block is deprecated; a versioned formula the user opts into by NAME is the | |
| # supported pattern, and the name is the "experimental" marking. | |
| - name: Dispatch formula update to homebrew-tap | |
| env: | |
| GH_TOKEN: ${{ secrets.HOMEBREW_TAP_SECRET }} | |
| run: | | |
| TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}" | |
| if [ "${{ github.event.release.prerelease }}" = "true" ]; then | |
| FORMULA="riddlc-rc" | |
| else | |
| FORMULA="riddlc" | |
| fi | |
| echo "Dispatching formula update for ${FORMULA} at ${TAG}" | |
| gh api repos/ossuminc/homebrew-tap/dispatches \ | |
| --method POST \ | |
| -f event_type=update-formula \ | |
| -f "client_payload[formula]=${FORMULA}" \ | |
| -f "client_payload[version]=${TAG}" \ | |
| -f "client_payload[sha_macos_arm64]=${{ steps.hashes.outputs.macos_arm64 }}" \ | |
| -f "client_payload[sha_linux_x86]=${{ steps.hashes.outputs.linux_x86 }}" \ | |
| -f "client_payload[sha_jvm]=${{ steps.hashes.outputs.jvm }}" | |
| # Notify ossum.ai to create a blog post from release notes. | |
| # | |
| # FULL RELEASES ONLY. Every other channel makes a release candidate opt-in by | |
| # name -- a prerelease on GitHub, an `rc` npm dist-tag, a separate `riddlc-rc` | |
| # formula -- but a blog post announces itself to everyone. 2.0.0-rc.1 shipped a | |
| # live post on ossum.ai because this job, unlike `update-homebrew` below, had no | |
| # prerelease guard. | |
| # | |
| # `workflow_dispatch` leaves `release.prerelease` empty, so a manual run still | |
| # posts; that is deliberate, since dispatching by hand is an explicit act. | |
| notify-blog: | |
| if: github.event.release.prerelease != true | |
| needs: [native-build, jvm-build] | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| env: | |
| TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }} | |
| steps: | |
| - name: Fetch release body | |
| id: release | |
| env: | |
| GH_TOKEN: ${{ secrets.BLOG_DISPATCH }} | |
| run: | | |
| BODY=$(gh api repos/ossuminc/riddl/releases/tags/${TAG} --jq '.body' 2>/dev/null || echo "") | |
| if [ -z "$BODY" ]; then | |
| echo "::warning::Could not fetch release body for ${TAG}" | |
| fi | |
| # Write to file to avoid shell quoting issues | |
| echo "$BODY" > /tmp/release-body.txt | |
| - name: Dispatch blog post creation | |
| env: | |
| GH_TOKEN: ${{ secrets.BLOG_DISPATCH }} | |
| run: | | |
| BODY=$(cat /tmp/release-body.txt) | |
| gh api repos/ossuminc/ossum.ai/dispatches \ | |
| --method POST \ | |
| --input - <<PAYLOAD | |
| { | |
| "event_type": "riddl-release", | |
| "client_payload": { | |
| "product": "riddl", | |
| "version": "${TAG}", | |
| "release_url": "https://github.com/ossuminc/riddl/releases/tag/${TAG}", | |
| "body": $(echo "$BODY" | jq -Rs .) | |
| } | |
| } | |
| PAYLOAD |