another attempt at automated version #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: Build | |
| permissions: | |
| contents: write | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION: 1.${{ github.run_number }}.0 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - run: rustup toolchain install stable | |
| - run: rustup target add wasm32-unknown-unknown | |
| - run: sed -i 's/version = "1.42.0"/version = "${{ env.VERSION }}"/' Cargo.toml | |
| - run: cargo build | |
| - run: cargo clippy | |
| - run: cargo test | |
| - run: cargo build --target wasm32-unknown-unknown --release | |
| - run: mv target/wasm32-unknown-unknown/release/dprint_plugin_sql.wasm target/wasm32-unknown-unknown/release/plugin.wasm | |
| - run: sed -i 's/v1.42.0/v${{ env.VERSION }}/' schema.json | |
| - uses: softprops/action-gh-release@v2 | |
| if: github.ref == 'refs/heads/main' | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| files: | | |
| target/wasm32-unknown-unknown/release/plugin.wasm | |
| schema.json | |
| body: | | |
| ## Install | |
| [Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint. | |
| Then in your project's dprint configuration file: | |
| 1. Specify the plugin url in the `"plugins"` array. | |
| 2. Add a `"sql"` configuration property if desired. | |
| ```jsonc | |
| { | |
| // ...etc... | |
| "sql": { | |
| // sql config goes here | |
| }, | |
| "plugins": [ | |
| "https://plugins.dprint.dev/daaku/sql-v${{ env.VERSION }}.wasm" | |
| ] | |
| } | |
| ``` |