Improve init #31
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 and Package DSQL | |
| on: | |
| workflow_dispatch: # Allow manual triggering | |
| push: | |
| branches: ["*"] # Run on all branch pushes (CI) | |
| tags: ['v*'] # Run on version tags (Release) | |
| pull_request: | |
| branches: ["*"] # Run on all pull requests (CI) | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-22.04] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: "recursive" | |
| - name: Set up macOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew update | |
| brew install openssl@3 icu4c zip readline go | |
| - name: Set up Ubuntu | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| flex \ | |
| bison \ | |
| libreadline-dev \ | |
| zlib1g-dev \ | |
| libssl-dev \ | |
| libicu-dev \ | |
| build-essential \ | |
| cmake \ | |
| zip \ | |
| rpm \ | |
| patchelf | |
| - name: Build DSQL | |
| run: | | |
| chmod +x scripts/build-dsql.sh | |
| ./scripts/build-dsql.sh | |
| - name: Package for Distribution | |
| run: | | |
| chmod +x scripts/package.sh | |
| ./scripts/package.sh | |
| - name: Test Package | |
| run: | | |
| chmod +x scripts/test-packaging.sh | |
| ./scripts/test-packaging.sh --test-only | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: postgres-dsql-${{ matrix.os }}-${{ runner.arch }} | |
| path: build/postgres-dsql.zip | |
| - name: Upload RPM Artifact | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: postgres-dsql-rpm-${{ matrix.os }}-${{ runner.arch }} | |
| path: "build/*.rpm" | |
| - name: Upload DEB Artifact | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: postgres-dsql-deb-${{ matrix.os }}-${{ runner.arch }} | |
| path: "build/*.deb" | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release-files | |
| # Rename ZIP files to be unique | |
| find artifacts -name "postgres-dsql.zip" | while read file; do | |
| dir=$(dirname "$file") | |
| artifact_name=$(basename "$dir") | |
| # Extract platform info from artifact name | |
| if [[ "$artifact_name" == *"macos"* ]]; then | |
| if [[ "$artifact_name" == *"ARM64"* ]]; then | |
| cp "$file" "release-files/postgres-dsql-macos-arm64.zip" | |
| else | |
| cp "$file" "release-files/postgres-dsql-macos-x64.zip" | |
| fi | |
| elif [[ "$artifact_name" == *"ubuntu"* ]]; then | |
| if [[ "$artifact_name" == *"ARM64"* ]]; then | |
| cp "$file" "release-files/postgres-dsql-linux-arm64.zip" | |
| else | |
| cp "$file" "release-files/postgres-dsql-linux-x64.zip" | |
| fi | |
| fi | |
| done | |
| # Copy other files with original names | |
| find artifacts -name "*.rpm" -exec cp {} release-files/ \; | |
| find artifacts -name "*.deb" -exec cp {} release-files/ \; | |
| echo "Release files prepared:" | |
| ls -la release-files/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release-files/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |