ci #4
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: ci | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag: <upstream version>-bwa.<release index> (e.g., v0.1.3-bwa.5)" | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: sqlc-dev/setup-sqlc@v4 | |
| with: | |
| sqlc-version: '1.24.0' | |
| - uses: actions/setup-node@v4 | |
| - run: wget https://github.com/bytecodealliance/javy/releases/download/v1.2.0/javy-x86_64-linux-v1.2.0.gz | |
| - run: gzip -d javy-x86_64-linux-v1.2.0.gz | |
| - run: chmod +x javy-x86_64-linux-v1.2.0 | |
| - run: npm install | |
| - run: npx tsc --noEmit | |
| - run: npx esbuild --bundle src/app.ts --tree-shaking=true --format=esm --target=es2020 --outfile=out.js | |
| - run: ./javy-x86_64-linux-v1.2.0 compile out.js -o examples/plugin.wasm | |
| - run: sqlc -f sqlc.dev.yaml diff | |
| working-directory: examples | |
| - run: | | |
| set -euo pipefail | |
| sha=$(sha256sum examples/plugin.wasm | awk '{print $1}') | |
| url="https://github.com/blue-water-autonomy/sqlc-gen-typescript/releases/download/${{ inputs.tag }}/plugin.wasm" | |
| cat > RELEASE_NOTES.txt <<EOF | |
| # Configuration | |
| ``` | |
| version: '2' | |
| plugins: | |
| - name: ts | |
| wasm: | |
| url: ${url} | |
| sha256: ${sha} | |
| ``` | |
| EOF | |
| - env: | |
| # Fine-grained personal access token with access only to this repository, Permissions: "Contents, Access: Read and Write" | |
| GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} | |
| run: | | |
| gh release create "${{ inputs.tag }}" \ | |
| examples/plugin.wasm \ | |
| --title "${{ inputs.tag }}" \ | |
| --notes-file RELEASE_NOTES.txt |