Skip to content

Commit

Permalink
🔨 Trigger package release test workflow after publishing
Browse files Browse the repository at this point in the history
- Added `released_package_test.yml` workflow to verify the released package.
- Modified `release.yml` to trigger `released_package_test.yml` via API when a release is created.
- Passes the published package version and a delay parameter to the test workflow.
- Ensures the CLI package exits correctly using `npx @liam-hq/cli@<version> --version`.
  • Loading branch information
hoshinotsuyoshi committed Feb 12, 2025
1 parent e163b46 commit 319f2ad
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ jobs:
token: ${{ steps.app-token.outputs.token }}
- uses: ./.github/actions/pnpm-setup
- name: Create Release Pull Request or Publish to npm
id: changesets-action
uses: changesets/action@v1.4.9
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Trigger released_package_test.yml via API
if: ${{ steps.changesets-action.outputs.release_created == 'true' }}
run: |
version=$(cat frontend/packages/cli/package.json | jq -r '.version')
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/released_package_test.yml/dispatches \
-d '{"ref":"main", "inputs": { "delay_seconds": "60", "version": "'${version}'" }}'
32 changes: 32 additions & 0 deletions .github/workflows/released_package_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "released package test"

on:
workflow_dispatch:
inputs:
delay_seconds:
description: "Delay in seconds before execution"
required: false
default: 0
type: number
version:
description: "Version to test"
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: sleep
run: |
echo "Starting after ${{ github.event.inputs.delay_seconds }} seconds"
sleep ${{ github.event.inputs.delay_seconds }}
- name: check @liam-hq/cli exit code
run: |
version="${{ github.event.inputs.version }}"
docker run --rm -it node:20-bullseye npx --yes @liam-hq/cli@${version} --version

0 comments on commit 319f2ad

Please sign in to comment.