Deploy #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: Deploy | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: "The type of the release" | |
| required: true | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| jobs: | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Update version | |
| run: bash .github/scripts/bump_version.sh ${{ inputs.version_type }} | |
| - name: Commit Changes | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "Bump version for release" | |
| file_pattern: "internal/core/*.go" | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: './go.mod' | |
| - name: Build plugin | |
| working-directory: plugin | |
| run: GOOS=wasip1 GOARCH=wasm go build -o ../tests/sqlc-gen-java.wasm | |
| - name: Create tag | |
| run: | | |
| git tag ${{ steps.update-version.outputs.VERSION }} | |
| git push origin ${{ steps.update-version.outputs.VERSION }} | |
| - name: Generate release description | |
| run: | | |
| export checksum=$(sha256sum sqlc-gen-java.wasm | awk '{print $1}') | |
| export download_url="https://github.com/tandemdude/releases/download/${{ steps.update-version.outputs.VERSION }}/sqlc-gen-java.wasm" | |
| yq -i '.plugins[0].wasm.url = env(download_url)' .github/release_output_template.yaml | |
| yq -i '.plugins[0].wasm.sha256 = env(checksum)' .github/release_output_template.yaml | |
| echo "\`\`\`yaml" > release_body.md | |
| cat .github/release_output_template.yaml >> release_body.md | |
| echo "\`\`\`" >> release_body.md | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| name: "${{ steps.update-version.outputs.VERSION }}" | |
| tag_name: "refs/tags/${{ steps.update-version.outputs.VERSION }}" | |
| body_path: release_body.md | |
| files: sqlc-gen-java.wasm |