Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: run on review of release PR #33

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .changeset/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ const getAddMessage = async (changeset) => {
return `docs(changeset): ${changeset.summary}\n\n${getSignedOffBy()}\n`
}

const getVersionMessage = async (releasePlan) => {
const publishableReleases = releasePlan.releases.filter((release) => release.type !== 'none')
const releasedVersion = publishableReleases[0].newVersion

return `chore(release): version ${releasedVersion}\n\n${getSignedOffBy()}\n`
const getVersionMessage = async () => {
return `chore(release): new verion\n\n${getSignedOffBy()}\n`
}

module.exports = {
Expand Down
6 changes: 6 additions & 0 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: 'Setup and install'
description: 'Common setup steps for Actions'

inputs:
node-version:
description: 'Node.js version to use'
required: false

runs:
using: composite
steps:
Expand All @@ -9,6 +14,7 @@ runs:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
node-version: ${{ inputs.node-version }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: ci
name: Continuous Integration

on:
pull_request_review:

pull_request:
branches: ['*']
push:
Expand All @@ -11,15 +13,12 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

# You can leverage Vercel Remote Caching with Turbo to speed up your builds
# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds
env:
FORCE_COLOR: 3
TURBO_TEAM: ${{ secrets.VERCEL_TEAM_ID }}
TURBO_TOKEN: ${{ secrets.VERCEL_TOKEN }}

jobs:
format-and-lint:
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -31,6 +30,7 @@ jobs:
run: pnpm format-and-lint

build:
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -42,6 +42,7 @@ jobs:
run: pnpm build

typecheck:
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
runs-on: ubuntu-latest
needs: [build]
steps:
Expand All @@ -54,13 +55,20 @@ jobs:
run: pnpm typecheck

test:
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/setup
with:
node-version: ${{ matrix.node-version }}

- name: Test
run: pnpm test
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ jobs:
release-stable:
name: Release Stable
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup
uses: ./.github/setup

- name: Create Release Pull Request
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
Expand All @@ -44,15 +46,16 @@ jobs:
run: echo "CURRENT_PACKAGE_VERSION=$(node -p "require('./dcql/package.json').version")" >> $GITHUB_ENV

- name: Create Github Release
if: "startsWith(github.event.head_commit.message, 'chore(release): new version')"
if: steps.changesets.outputs.published == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.CURRENT_PACKAGE_VERSION }}

release-unstable:
name: Release Unstable
runs-on: ubuntu-latest
if: "always() && github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release): new version')"
needs: release-stable
if: always() && github.event_name == 'push' && needs.release-stable.outputs.published == 'false'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
Loading