Skip to content

fix: properly surface hook trace statuses (#2022) #1547

fix: properly surface hook trace statuses (#2022)

fix: properly surface hook trace statuses (#2022) #1547

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
# We have setup NPM trusted publishing which requires running the release
# workflow on GitHub-hosted runners. It can running on ubicloud or any other
# self-hosted runners that we manage.
# https://docs.npmjs.com/trusted-publishers
runs-on: ubuntu-latest
permissions:
contents: write # to push tags
pull-requests: read
issues: read
id-token: write # to publish to NPM
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
env:
GRAM_GIT_SHA: "${{ github.sha }}"
steps:
- name: Checkout Repo
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
- name: Setup Mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
install: true
cache: true
env: false
- name: Prepare GitHub Actions environment
run: mise run github
- name: Cache PNPM
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
key: ${{ env.GH_CACHE_PNPM_KEY }}
restore-keys: |
${{ env.GH_CACHE_PNPM_KEY }}
${{ env.GH_CACHE_PNPM_KEY_PARTIAL }}
path: |
${{ env.PNPM_STORE_PATH }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@b96fde71c0080358ed6e2d162f11c612c92a97d1 # v2.1.4
with:
app-id: ${{ vars.GRAM_BOT_APP_ID }}
private-key: ${{ secrets.GRAM_BOT_PRIVATE_KEY }}
# Configure git to commit as the GitHub App so commits trigger workflows.
# Commits from github-actions[bot] don't trigger workflows by design.
- name: Configure git for GitHub App
run: |
git config user.name "gram-bot[bot]"
git config user.email "gram-bot[bot]@users.noreply.github.com"
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0
with:
title: "chore: version packages"
publish: mise exec --env viteprod -- pnpm changeset publish
setupGitUser: false
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
# Datadog RUM credentials for @gram-ai/elements error tracking
VITE_DATADOG_APPLICATION_ID: ${{ secrets.VITE_DATADOG_APPLICATION_ID }}
VITE_DATADOG_CLIENT_TOKEN: ${{ secrets.VITE_DATADOG_CLIENT_TOKEN }}
VITE_DATADOG_SITE: ${{ secrets.VITE_DATADOG_SITE }}
- name: Prune PNPM store
run: pnpm store prune
release-cli:
needs: [release]
if: needs.release.outputs.published == 'true' && contains(fromJSON(needs.release.outputs.publishedPackages).*.name, 'cli')
name: Release Gram CLI
runs-on: ubuntu-latest
permissions:
contents: write # to push tags
id-token: write # for cosign keyless signing
steps:
- name: Checkout repository
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
with:
fetch-depth: 0
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: "go.mod"
# Reference: https://github.com/actions/setup-go/issues/495
cache: false
- name: Install cosign
uses: sigstore/cosign-installer@ba7bc0a3fef59531c69a25acd34668d6d3fe6f22 # v4.1.0
- name: Generate GitHub App Token for Gram Bot
id: bot-token
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
with:
app-id: ${{ secrets.GRAM_BOT_APP_ID }}
private-key: ${{ secrets.GRAM_BOT_PRIVATE_KEY }}
owner: speakeasy-api
repositories: gram,homebrew-tap
- name: Create release tag
# GoReleaser expects a tag on HEAD before releasing. The newest tag
# will be on an old commit, specified by `changeset`, so this is a
# local-only tag to help GoReleaser publish.
run: |
version=$(jq -r .version cli/package.json)
tag="cli/$version"
git tag -f "$tag"
echo "Created local tag $tag"
- name: goreleaser
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0
with:
distribution: goreleaser-pro
version: "~> v2.14"
args: release --clean
env:
GITHUB_TOKEN: ${{ steps.bot-token.outputs.token }}
GORELEASER_KEY: ${{secrets.GORELEASER_PRO_LICENSE_KEY}}