|
1 | 1 | name: Build and Release PostgreSQL with PostGIS and pgRouting |
2 | 2 |
|
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 6 | + |
3 | 7 | on: |
4 | 8 | push: |
5 | 9 | branches: |
6 | | - - master |
| 10 | + - release |
7 | 11 | workflow_dispatch: |
8 | 12 |
|
9 | 13 | jobs: |
10 | 14 | build-and-release: |
11 | | - runs-on: macos-latest |
12 | 15 | strategy: |
13 | 16 | matrix: |
14 | | - # pg_version: ["13.14", "14.11", "15.6", "16.2"] |
15 | | - pg_version: ["13.14"] |
| 17 | + pg_version: ["13.15", "14.12", "15.7", "16.3"] |
| 18 | + os: [macos-15-large, macos-15-xlarge] |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + working-directory: scripts |
16 | 23 | steps: |
17 | 24 | - name: Checkout repository |
18 | 25 | uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Decode and import the certificate |
| 28 | + run: | |
| 29 | + # Decode the base64-encoded certificate and save it as a .p12 file |
| 30 | + echo "${{ secrets.CERTIFICATE_P12_BASE64 }}" | base64 --decode > certificate.p12 |
| 31 | + |
| 32 | + # Import the .p12 certificate into the macOS keychain |
| 33 | + security create-keychain -p "temp-password" build.keychain |
| 34 | + security import certificate.p12 -k build.keychain -P "${{ secrets.CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign |
| 35 | + |
| 36 | + # Set the keychain as default and unlock it |
| 37 | + security list-keychains -s build.keychain |
| 38 | + security unlock-keychain -p "temp-password" build.keychain |
| 39 | + |
| 40 | + # Set keychain settings to prevent it from locking automatically |
| 41 | + security set-keychain-settings build.keychain |
| 42 | + |
| 43 | + # Pre-authorize codesign to access the certificate |
| 44 | + security set-key-partition-list -S apple-tool:,apple: -s -k "temp-password" build.keychain |
| 45 | +
|
| 46 | + echo "SIGN_IDENTITY=${{ secrets.SIGN_IDENTITY }}" >> $GITHUB_ENV |
| 47 | + echo "APPLE_ID=${{ secrets.APPLE_ID }}" >> $GITHUB_ENV |
| 48 | + echo "APPLE_APP_SPECIFIC_PASSWORD=${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" >> $GITHUB_ENV |
| 49 | + echo "APPLE_TEAM_ID=${{ secrets.APPLE_TEAM_ID }}" >> $GITHUB_ENV |
19 | 50 |
|
20 | 51 | - name: Build PostgreSQL, PostGIS, and Dependencies |
| 52 | + id: build_postgres |
21 | 53 | run: | |
22 | | - ./build_postgres.sh -v ${{ matrix.pg_version }} -p darwin -a arm64v8 -g 3.1.4 -r 3.2.0 |
| 54 | + ./build-postgres-darwin.sh -v ${{ matrix.pg_version }} -g 3.4.2 -r 3.6.2 |
| 55 | + if [ "${{ matrix.os }}" == "macos-15-xlarge" ]; then |
| 56 | + echo "ARCH=arm64" >> $GITHUB_OUTPUT |
| 57 | + echo "FILENAME=postgresql-${{ matrix.pg_version }}-darwin-arm64.zip" >> $GITHUB_OUTPUT |
| 58 | + else |
| 59 | + echo "ARCH=amd64" >> $GITHUB_OUTPUT |
| 60 | + echo "FILENAME=postgresql-${{ matrix.pg_version }}-darwin-amd64.zip" >> $GITHUB_OUTPUT |
| 61 | + fi |
23 | 62 |
|
24 | 63 | - name: Prepare Release Assets |
25 | 64 | run: | |
26 | 65 | mkdir -p release |
27 | | - cp bundle/postgres-macos.txz "release/postgresql-${{ matrix.pg_version }}-macos.txz" |
| 66 | + cp bundle/postgres-macos.zip "release/${{ steps.build_postgres.outputs.FILENAME }}" |
28 | 67 |
|
29 | 68 | - name: Calculate SHA256 Checksums |
| 69 | + id: calculate_sha256 |
30 | 70 | run: | |
31 | 71 | cd release |
32 | | - shasum -a 256 postgresql-${{ matrix.pg_version }}-macos.txz > SHA256SUMS.txt |
| 72 | + echo "SHA256SUMS=$(shasum -a 256 ${{ steps.build_postgres.outputs.FILENAME }} | awk '{print $1}')" >> $GITHUB_OUTPUT |
| 73 | +
|
| 74 | + - name: Get date |
| 75 | + id: get_date |
| 76 | + run: | |
| 77 | + echo "DATE=$(date +%Y%m%d)" >> $GITHUB_OUTPUT |
| 78 | +
|
| 79 | + - name: Delete Existing Release |
| 80 | + if: always() |
| 81 | + run: | |
| 82 | + tag="v${{ matrix.pg_version }}-macos-${{ steps.build_postgres.outputs.ARCH }}-${{ steps.get_date.outputs.DATE }}" |
| 83 | + release_id=$(gh release view "$tag" --json id -q '.id' 2>/dev/null || echo "") |
| 84 | + if [[ -n "$release_id" ]]; then |
| 85 | + gh release delete "$tag" -y |
| 86 | + fi |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
33 | 89 |
|
34 | 90 | - name: Create GitHub Release |
35 | 91 | id: create_release |
36 | 92 | uses: actions/create-release@v1 |
37 | 93 | env: |
38 | 94 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
39 | 95 | with: |
40 | | - tag_name: "v${{ matrix.pg_version }}-$(date +%Y%m%d)" |
41 | | - release_name: "PostgreSQL ${{ matrix.pg_version }} with PostGIS 3.4.0 and pgRouting 3.4.2" |
| 96 | + tag_name: "v${{ matrix.pg_version }}-macos-${{ steps.build_postgres.outputs.ARCH }}-${{ steps.get_date.outputs.DATE }}" |
| 97 | + release_name: "${{ matrix.pg_version }}-macos-${{ steps.build_postgres.outputs.ARCH }}-${{ steps.get_date.outputs.DATE }}" |
42 | 98 | draft: false |
43 | 99 | prerelease: false |
44 | 100 | body: | |
45 | 101 | SHA256 Checksums: |
46 | 102 | ``` |
47 | | - $(cat release/SHA256SUMS.txt) |
| 103 | + ${{ steps.calculate_sha256.outputs.SHA256SUMS }} |
48 | 104 | ``` |
49 | 105 |
|
50 | 106 | - name: Upload Release Asset |
|
53 | 109 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
54 | 110 | with: |
55 | 111 | upload_url: ${{ steps.create_release.outputs.upload_url }} |
56 | | - asset_path: release/postgresql-${{ matrix.pg_version }}-macos.txz |
57 | | - asset_name: postgresql-${{ matrix.pg_version }}-macos.txz |
| 112 | + asset_path: scripts/release/${{ steps.build_postgres.outputs.FILENAME }} |
| 113 | + asset_name: ${{ steps.build_postgres.outputs.FILENAME }} |
58 | 114 | asset_content_type: application/x-tar |
59 | | - |
|
0 commit comments