Skip to content

Commit 660936c

Browse files
authored
[Feature] macos postgis (#4)
* fix filename * fix * Update build_postgres.sh * Update build-and-release-macos.yml * Update build_postgres.sh * Update build_postgres.sh * Update build-and-release-macos.yml * Update build_postgres.sh * move around * test large * add ARM build * wip * fix * adjust * working * adjust * adjust * add concurrency * fix * add clean up step * build fewer versions for now * fix for amd64 * Update build-and-release-macos.yml * use newer postgis version to align with AWS * fix * fix shasum logic * fix * remove code sign * bugfix * switch to loader path * add code sign * try code signing * WIP * WIP * WIP * WIP * WIP * try different notarization * fix name * Update build-postgres-darwin.sh * Update build-and-release-macos.yml * Update build-and-release-macos.yml * Update build-and-release-macos.yml
1 parent e04a89d commit 660936c

File tree

3 files changed

+356
-128
lines changed

3 files changed

+356
-128
lines changed

.github/workflows/build-and-release-macos.yml

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,106 @@
11
name: Build and Release PostgreSQL with PostGIS and pgRouting
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
6+
37
on:
48
push:
59
branches:
6-
- master
10+
- release
711
workflow_dispatch:
812

913
jobs:
1014
build-and-release:
11-
runs-on: macos-latest
1215
strategy:
1316
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
1623
steps:
1724
- name: Checkout repository
1825
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
1950
2051
- name: Build PostgreSQL, PostGIS, and Dependencies
52+
id: build_postgres
2153
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
2362
2463
- name: Prepare Release Assets
2564
run: |
2665
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 }}"
2867
2968
- name: Calculate SHA256 Checksums
69+
id: calculate_sha256
3070
run: |
3171
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 }}
3389

3490
- name: Create GitHub Release
3591
id: create_release
3692
uses: actions/create-release@v1
3793
env:
3894
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3995
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 }}"
4298
draft: false
4399
prerelease: false
44100
body: |
45101
SHA256 Checksums:
46102
```
47-
$(cat release/SHA256SUMS.txt)
103+
${{ steps.calculate_sha256.outputs.SHA256SUMS }}
48104
```
49105
50106
- name: Upload Release Asset
@@ -53,7 +109,6 @@ jobs:
53109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54110
with:
55111
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 }}
58114
asset_content_type: application/x-tar
59-

build_postgres.sh

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)