Skip to content

release: version packages (alpha) #78

release: version packages (alpha)

release: version packages (alpha) #78

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@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Test
run: pnpm test
- name: "Report Coverage"
if: always()
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: ./apps/cli
- name: Create Release Pull Request or Publish to npm
id: changeset
uses: changesets/action@v1
with:
commit: "release: version packages"
publish: pnpm run publish-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
packages_to_build:
name: Get released packages
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
outputs:
packages: ${{ steps.packages.outputs.PACKAGES }}
steps:
- name: Get released packages
id: packages
run: |
echo "PACKAGES=$(jq -c '[ .[].name ]' <(echo '${{ needs.release.outputs.publishedPackages }}'))" >> "$GITHUB_OUTPUT"
build_sdk:
name: Build sdk
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/sdk') }}
uses: ./.github/workflows/sdk.yaml
secrets: inherit