Test release #24
Workflow file for this run
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 & Release Development pre-release | |
| on: | |
| push: | |
| branches: | |
| - "feature/dev-releases" | |
| tags: | |
| - "v*-dev.*" | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - ubuntu-22.04-arm | |
| - windows-latest | |
| - macos-13 | |
| - macos-latest | |
| outputs: | |
| artifact-name: ${{ steps.get_artifact_name.outputs.artifact }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies and PyInstaller | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: Determine version (Unix) | |
| id: get-version | |
| if: runner.os != 'Windows' | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| version="${{ github.ref }}" # Extract version from tag | |
| version="${version##*/}" | |
| else | |
| branch="${{ github.ref }}" # Extract version from branch name | |
| branch="${branch##*/}" | |
| version="dev-${branch}" | |
| fi | |
| echo "version=$version" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Determine version (Windows) | |
| id: get-version-win | |
| if: runner.os == 'Windows' | |
| run: | | |
| if ($env:GITHUB_REF -like 'refs/tags/*') { | |
| $version = $env:GITHUB_REF -replace 'refs/tags/', '' | |
| } else { | |
| $branch = $env:GITHUB_REF -replace 'refs/heads/', '' | |
| $branchParts = $branch -split '/' | |
| $branchName = $branchParts[-1] | |
| $version = "dev-$branchName" | |
| } | |
| echo "version=$version" >> $env:GITHUB_ENV | |
| shell: pwsh | |
| - name: Run build script (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| chmod +x scripts/build.sh | |
| ./scripts/build.sh | |
| - name: Run build script (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| powershell -File scripts/build.ps1 | |
| - name: Get artifact name | |
| id: get_artifact_name | |
| run: | | |
| artifact=$(scripts/get-artifact-name.sh "${{ matrix.os }}" "$({{ env.version }})") | |
| echo "artifact=$artifact" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Archive artifact (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| tar -czf "${{ steps.get_artifact_name.outputs.artifact }}" -C dist pgsqltoolsservice | |
| shell: bash | |
| - name: Archive artifact (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| pwsh -Command " | |
| Compress-Archive -Path .\dist\pgsqltoolsservice -DestinationPath .\${{ steps.get_artifact_name.outputs.artifact }} -Force" | |
| shell: pwsh | |
| - name: Upload build artifact (Unix) | |
| uses: actions/upload-artifact@v4 | |
| if: runner.os != 'Windows' | |
| with: | |
| name: ${{ steps.get_artifact_name.outputs.artifact }} | |
| path: ${{ steps.get_artifact_name.outputs.artifact }} | |
| - name: Upload build artifact (Windows) | |
| uses: actions/upload-artifact@v4 | |
| if: runner.os == 'Windows' | |
| with: | |
| name: ${{ steps.get_artifact_name.outputs.artifact }} | |
| path: ${{ steps.get_artifact_name.outputs.artifact }} | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: write | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| steps: | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref == 'refs/heads/feature/dev-releases' && 'v.10.1-dev.0' || github.ref }} | |
| release_name: ${{ github.ref == 'refs/heads/feature/dev-releases' && 'v.10.1-dev.0 (Test)' || github.ref }} | |
| draft: false | |
| prerelease: true | |
| body: | | |
| Development release ${{ github.ref }}. | |
| This is used for testing purposes only. Do not use in production. | |
| publish: | |
| name: Publish to GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [build, create-release] | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| os: | |
| [ | |
| ubuntu-latest, | |
| ubuntu-22.04-arm, | |
| windows-latest, | |
| macos-13, | |
| macos-latest, | |
| ] | |
| steps: | |
| - name: Get artifact name | |
| id: get_art_name | |
| run: | | |
| artifact=$(scripts/get-artifact-name.sh "${{ matrix.os }}" "$({{ env.version }})") | |
| echo "artifact=$artifact" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Download artifact for ${{ matrix.os }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ steps.get_art_name.outputs.artifact }} | |
| path: dev | |
| - name: Upload Release Asset for ${{ matrix.os }} (Non-Windows) | |
| if: matrix.os != 'windows-latest' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.create-release.outputs.upload_url }} | |
| asset_path: dev/${{ steps.get_art_name.outputs.artifact }} | |
| asset_name: ${{ steps.get_art_name.outputs.artifact }} | |
| asset_content_type: application/gzip | |
| - name: Upload Release Asset for ${{ matrix.os }} (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.create-release.outputs.upload_url }} | |
| asset_path: dev/${{ steps.get_art_name.outputs.artifact }} | |
| asset_name: ${{ steps.get_art_name.outputs.artifact }} | |
| asset_content_type: application/zip |