Version Packages #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Release | |
on: | |
push: | |
branches: ["**"] | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
test-and-release: | |
name: Test and Release | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
# See https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8.15 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.12.1 | |
cache: "pnpm" | |
- name: Install deps | |
run: pnpm install --frozen-lockfile | |
- name: Build packages | |
run: pnpm run -r build | |
- name: Test packages | |
run: pnpm run -r test | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost | |
- name: Create Release Pull Request or Publish to npm | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |