Release DoltgreSQL #81
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 DoltgreSQL | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'SemVer format release tag, i.e. 0.2.4' | |
| required: true | |
| jobs: | |
| format-version: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| version: ${{ steps.format_version.outputs.version }} | |
| steps: | |
| - name: Format Input | |
| id: format_version | |
| run: | | |
| version="${{ github.event.inputs.version }}" | |
| if [[ $version == v* ]]; | |
| then | |
| version="${version:1}" | |
| fi | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| windows-extension-support: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN || secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| - name: Build SQL Syntax | |
| run: ./build.sh | |
| working-directory: ./postgres/parser | |
| shell: bash | |
| - name: Upload Extension Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-extension-artifacts | |
| path: | | |
| ./core/extensions/pg_extension/output/pg_extension.dll | |
| ./core/extensions/pg_extension/output/postgres.exe | |
| if-no-files-found: error | |
| retention-days: 1 | |
| create-release: | |
| needs: [format-version, windows-extension-support] | |
| name: Create release | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| release_id: ${{ steps.create_release.outputs.id }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN || secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| - name: Build SQL Syntax | |
| run: ./build.sh | |
| working-directory: ./postgres/parser | |
| shell: bash | |
| - name: Update Doltgres version command | |
| run: sed -i -e 's/Version\s*=\s*".*"/Version = "'"$NEW_VERSION"'"/' "$FILE" | |
| env: | |
| FILE: ${{ format('{0}/server/server.go', github.workspace) }} | |
| NEW_VERSION: ${{ needs.format-version.outputs.version }} | |
| - name: Set minver TBD to version | |
| run: sed -i -e 's/minver:"TBD"/minver:"'"$NEW_VERSION"'"/' "$FILE" | |
| env: | |
| FILE: ${{ format('{0}/servercfg/config.go', github.workspace) }} | |
| NEW_VERSION: ${{ needs.format-version.outputs.version }} | |
| - name: update minver_validation.txt | |
| working-directory: ./ | |
| run: go run -mod=readonly ./utils/genminver_validation/ $FILE | |
| env: | |
| FILE: ${{ format('{0}/servercfg/testdata/minver_validation.txt', github.workspace) }} | |
| - uses: EndBug/add-and-commit@v9.1.1 | |
| with: | |
| message: ${{ format('Update DoltgreSQL version to {0}', needs.format-version.outputs.version) }} | |
| add: ${{ format('["{0}/server/server.go", "{0}/servercfg/config.go", "{0}/servercfg/testdata/minver_validation.txt"]', github.workspace) }} | |
| cwd: "." | |
| new_branch: cd-release | |
| - name: Create Pull Request | |
| run: gh pr create --base main --head "cd-release" --title "[no-release-notes] Release v${{ needs.format-version.outputs.version }}" --body "Created by the Release workflow to update DoltgreSQL's version" | |
| env: | |
| GH_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN || secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| - name: Enable Pull Request Auto-Merge | |
| run: gh pr merge --merge --auto "cd-release" | |
| env: | |
| GH_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN || secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| - name: Download Extension Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-extension-artifacts | |
| path: ./core/extensions/pg_extension/output | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Free up disk space | |
| shell: bash | |
| run: | | |
| sudo find /opt -maxdepth 1 -mindepth 1 \ | |
| ! -path /opt/containerd \ | |
| ! -path /opt/actionarchivecache \ | |
| ! -path /opt/runner \ | |
| ! -path /opt/runner-cache \ | |
| -exec rm -rf {} \; | |
| - name: Build Binaries | |
| id: build_binaries | |
| run: | | |
| latest=$(git rev-parse HEAD) | |
| echo "commitish=$latest" >> $GITHUB_OUTPUT | |
| GO_BUILD_VERSION=1.25 scripts/build_binaries.sh | |
| - name: Fix ownership of build artifacts | |
| run: sudo chown -R "$USER:$USER" out | |
| - name: Create Release | |
| id: create_release | |
| uses: dolthub/create-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ needs.format-version.outputs.version }} | |
| release_name: ${{ needs.format-version.outputs.version }} | |
| draft: false | |
| commitish: ${{ steps.build_binaries.outputs.commitish }} | |
| - name: Create install script | |
| id: create-install-script | |
| shell: bash | |
| run: scripts/build_install_script.sh | |
| env: | |
| DOLTGRES_VERSION: ${{ needs.format-version.outputs.version }} | |
| - name: Upload Linux AMD64 Distro | |
| id: upload-linux-amd64-distro | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/doltgresql-linux-amd64.tar.gz | |
| asset_name: doltgresql-linux-amd64.tar.gz | |
| asset_content_type: application/zip | |
| - name: Upload Linux ARM64 Distro | |
| id: upload-linux-arm64-distro | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/doltgresql-linux-arm64.tar.gz | |
| asset_name: doltgresql-linux-arm64.tar.gz | |
| asset_content_type: application/zip | |
| - name: Upload OSX AMD64 Distro | |
| id: upload-osx-amd64-distro | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/doltgresql-darwin-amd64.tar.gz | |
| asset_name: doltgresql-darwin-amd64.tar.gz | |
| asset_content_type: application/zip | |
| - name: Upload OSX ARM64 Distro | |
| id: upload-osx-arm64-distro | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/doltgresql-darwin-arm64.tar.gz | |
| asset_name: doltgresql-darwin-arm64.tar.gz | |
| asset_content_type: application/zip | |
| - name: Upload Windows Distro | |
| id: upload-windows-distro | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/doltgresql-windows-amd64.zip | |
| asset_name: doltgresql-windows-amd64.zip | |
| asset_content_type: application/zip | |
| - name: Upload Windows Distro 7z | |
| id: upload-windows-distro-7z | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/doltgresql-windows-amd64.7z | |
| asset_name: doltgresql-windows-amd64.7z | |
| asset_content_type: application/x-7z-compressed | |
| - name: Upload install script | |
| id: upload-install-script | |
| uses: dolthub/upload-release-asset@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: out/install.sh | |
| asset_name: install.sh | |
| asset_content_type: text/plain | |
| create-release-notes: | |
| needs: [format-version, create-release] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Trigger Release Notes | |
| uses: peter-evans/repository-dispatch@v2.0.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| event-type: release-notes | |
| client-payload: '{"version": "${{ needs.format-version.outputs.version }}", "release_id": "${{ needs.create-release.outputs.release_id }}"}' | |
| trigger-performance-benchmark-email: | |
| needs: [format-version, create-release] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Trigger Performance Benchmarks | |
| uses: peter-evans/repository-dispatch@v2.0.0 | |
| with: | |
| token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
| event-type: release-doltgres | |
| client-payload: '{"version": "${{ needs.format-version.outputs.version }}", "actor": "${{ github.actor }}"}' |