Moved SQLITE_JS_VERSION outside of the first ifndef #6
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: release sqlite-js | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| name: build for ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| name: linux | |
| # - os: LinuxARM64 | |
| # arch: arm64 | |
| # name: linux | |
| - os: macos-latest | |
| name: macos | |
| - os: windows-latest | |
| arch: x86_64 | |
| name: windows | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| MAKEFLAGS: -j 8 | |
| steps: | |
| - uses: actions/[email protected] | |
| - name: windows install sqlite3 | |
| if: matrix.os == 'windows-latest' | |
| run: choco install sqlite -y | |
| - name: macos install sqlite3 without SQLITE_OMIT_LOAD_EXTENSION | |
| if: matrix.os == 'macos-latest' | |
| run: brew link sqlite --force | |
| - name: build sqlite-js | |
| run: make | |
| - name: test sqlite-js | |
| run: make test | |
| - uses: actions/[email protected] | |
| with: | |
| name: js-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} | |
| path: dist/js.* | |
| if-no-files-found: error | |
| release: | |
| runs-on: ubuntu-latest | |
| name: release | |
| needs: build | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: actions/[email protected] | |
| with: | |
| path: artifacts | |
| - name: release tag version from sqlitejs.h | |
| id: tag | |
| run: | | |
| FILE="src/sqlitejs.h" | |
| VERSION=$(grep -oP '#define SQLITE_JS_VERSION "\K[^"]+' "$FILE") | |
| if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "❌ SQLITE_JS_VERSION not found in sqlitejs.h" | |
| exit 1 | |
| - name: zip artifacts | |
| run: | | |
| for folder in "artifacts"/*; do | |
| if [ -d "$folder" ]; then | |
| name=$(basename "$folder") | |
| zip -jq "${name}-${{ steps.tag.outputs.version }}.zip" "$folder"/* | |
| tar -cJf "${name}-${{ steps.tag.outputs.version }}.tar.xz" -C "$folder" . | |
| tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" . | |
| fi | |
| done | |
| - uses: softprops/[email protected] | |
| with: | |
| generate_release_notes: true | |
| tag_name: ${{ steps.tag.outputs.version }} | |
| files: | | |
| js-*-${{ steps.tag.outputs.version }}.zip | |
| js-*-${{ steps.tag.outputs.version }}.tar.xz | |
| js-*-${{ steps.tag.outputs.version }}.tar.gz | |
| make_latest: true |