fix: node:sqlite import stripped by bundler (v0.2.0 crash with DB_PATH) #22
This file contains hidden or 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: Build and push Docker image | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| is_new_version: ${{ steps.check_tag.outputs.is_new }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| - name: Read version from package.json | |
| id: version | |
| run: | | |
| version=$(node -p "require('./package.json').version") | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Check if version tag already exists | |
| id: check_tag | |
| run: | | |
| if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | |
| echo "is_new=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_new=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=raw,value=${{ steps.version.outputs.version }},enable=${{ steps.check_tag.outputs.is_new }} | |
| type=raw,value=latest,enable=${{ steps.check_tag.outputs.is_new }} | |
| type=sha | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event_name != 'pull_request' }} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Create version tag | |
| if: github.event_name != 'pull_request' && steps.check_tag.outputs.is_new == 'true' | |
| run: | | |
| git tag "v${{ steps.version.outputs.version }}" | |
| git push origin "v${{ steps.version.outputs.version }}" | |
| release: | |
| if: github.event_name != 'pull_request' && needs.build.outputs.is_new_version == 'true' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract changelog for this version | |
| id: changelog | |
| run: | | |
| version="${{ needs.build.outputs.version }}" | |
| changelog=$(awk "/^## \[?${version//./\\.}\]?/{found=1; next} /^## \[?[0-9]/{if(found) exit} found{print}" CHANGELOG.md) | |
| if [ -z "$changelog" ]; then | |
| changelog="No changelog entry found for v${version}." | |
| fi | |
| echo "$changelog" > /tmp/release-notes.md | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "v${{ needs.build.outputs.version }}" \ | |
| --title "v${{ needs.build.outputs.version }}" \ | |
| --notes-file /tmp/release-notes.md |