first commit #1
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: migrator workflow | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: mydb | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 0.33 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- uses: bun/test@v1 | |
with: | |
bun-version: 'latest' | |
env: | |
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/mydb' | |
- run: bun test | |
- name: packageChanges | |
if: ${{ job.status == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- run: bun install --frozen-lockfile | |
- name: Lint code | |
run: bun run lint | |
- name: Build code | |
run: bun run build | |
publishPackage: | |
needs: packageChanges | |
if: needs.packageChanges.result == 'success' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- run: bun install --frozen-lockfile | |
- name: Authenticate with NPM | |
run: echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> ~/.npmrc | |
- name: Create Release Pull Request or Publish | |
id: changesets | |
run: | | |
bun run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GGITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |