Skip to content

release: version packages (alpha) #315

release: version packages (alpha)

release: version packages (alpha) #315

Workflow file for this run

name: Release
on:
push:
branches:
- main
- release/*
- prerelease/*
permissions:
actions: write
contents: write
id-token: write
packages: write
pull-requests: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changeset.outputs.published }}
publishedPackages: ${{ steps.changeset.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0
# Minimum required version for npm publish with OIDC Support
# https://docs.npmjs.com/trusted-publishers
- run: |
sudo npm install -g npm@latest
npm --version
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # 1.6.0
with:
version: v1.4.3
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Test
run: bun run test
- name: "Report Coverage"
if: always()
uses: davelosert/vitest-coverage-report-action@5a78cb16e761204097ad8a39369ea5d0ff7c8a5d # v2.8.0
with:
working-directory: ./apps/cli
- name: Create Release Pull Request or Publish to npm
id: changeset
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
commit: "release: version packages"
publish: bun run publish-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release CLI binaries
if: ${{ steps.changeset.outputs.published == 'true' && contains(fromJSON(steps.changeset.outputs.publishedPackages).*.name, '@cartesi/cli') }}
run: |
for f in cartesi-*; do tar -czf "$f.tar.gz" "$f"; done
VERSION=$(jq -r '.[] | select(.name=="@cartesi/cli") | .version' <<< '${{ steps.changeset.outputs.publishedPackages }}')
TAG="@cartesi/cli@${VERSION}"
gh release upload "$TAG" cartesi-*.tar.gz
working-directory: ./apps/cli/bin
env:
GH_TOKEN: ${{ github.token }}
build_sdk:
name: Build SDK
needs: release
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.release.outputs.publishedPackages).*.name, '@cartesi/sdk') }}
uses: ./.github/workflows/sdk.yaml
secrets: inherit