Added ATTACH AT TIME #15
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: Release fork to NPM | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
PACKAGE_VERSION: 0.32.1-${{ github.sha }} | |
jobs: | |
release: | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
- drizzle-orm | |
runs-on: ubuntu-20.04 | |
services: | |
postgres-postgis: | |
image: postgis/postgis:16-3.4 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: drizzle | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 54322:5432 | |
postgres-vector: | |
image: pgvector/pgvector:pg16 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: drizzle | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 54321:5432 | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: drizzle | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 55433:5432 | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: drizzle | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 33306:3306 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18.18' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: latest | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Generate prisma schemas | |
run: | | |
( | |
cd drizzle-orm | |
pnpm prisma generate --schema src/prisma/schema.prisma | |
) | |
( | |
cd integration-tests | |
pnpm prisma generate --schema tests/prisma/pg/schema.prisma | |
pnpm prisma generate --schema tests/prisma/mysql/schema.prisma | |
pnpm prisma generate --schema tests/prisma/sqlite/schema.prisma | |
) | |
- name: Build | |
working-directory: ${{ matrix.package }} | |
run: | | |
jq '.name="@drodrigues4/${{ matrix.package }}"' package.json --tab > tmp.$$.json && mv tmp.$$.json package.json | |
jq --arg version "$PACKAGE_VERSION" '.version=$version' package.json --tab > tmp.$$.json && mv tmp.$$.json package.json | |
jq 'del(.publishConfig.provenance)' package.json --tab > tmp.$$.json && mv tmp.$$.json package.json | |
pnpm build | |
- name: Run tests | |
if: 0 | |
env: | |
PG_CONNECTION_STRING: postgres://postgres:postgres@localhost:55433/drizzle | |
PG_VECTOR_CONNECTION_STRING: postgres://postgres:postgres@localhost:54321/drizzle | |
PG_POSTGIS_CONNECTION_STRING: postgres://postgres:postgres@localhost:54322/drizzle | |
MYSQL_CONNECTION_STRING: mysql://root:root@localhost:33306/drizzle | |
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }} | |
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }} | |
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }} | |
XATA_API_KEY: ${{ secrets.XATA_API_KEY }} | |
XATA_BRANCH: ${{ secrets.XATA_BRANCH }} | |
LIBSQL_URL: file:local.db | |
run: | | |
if [[ "${{ matrix.package }}" == "drizzle-orm" ]]; then | |
pnpm test --filter ${{ matrix.package }} --filter integration-tests | |
else | |
pnpm test --filter ${{ matrix.package }} | |
fi | |
- name: Pack | |
working-directory: ${{ matrix.package }} | |
shell: bash | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: | | |
npm run pack | |
- name: Run @arethetypeswrong/cli | |
if: 0 | |
working-directory: ${{ matrix.package }} | |
shell: bash | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: | | |
pnpm attw package.tgz | |
- name: Publish | |
working-directory: ${{ matrix.package }} | |
shell: bash | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc | |
echo "Publishing ${{ matrix.package }}@$PACKAGE_VERSION" | |
npm publish package.tgz --access public | |
echo "npm: \`+ ${{ matrix.package }}@$PACKAGE_VERSION\`" >> $GITHUB_STEP_SUMMARY | |
# Post release message to Discord | |
# curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }} |