Skip to content

Commit be51860

Browse files
committed
feat: ami-release-nix.yml workflow triggers for pg_upgrade scripts and bin flake version workflows
Once the AMI release workflow completes, it now triggers the pg_upgrade_scripts and pg_upgrade_bin flake version publishing workflows. This ensures that the necessary upgrade tools are published in sync with new PostgreSQL releases with the correct versioning.
1 parent 2ce1c4f commit be51860

File tree

3 files changed

+37
-12
lines changed

3 files changed

+37
-12
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ jobs:
168168
tag_name: ${{ steps.process_release_version.outputs.version }}
169169
target_commitish: ${{github.sha}}
170170

171+
- name: Trigger pg_upgrade_scripts workflow
172+
env:
173+
GH_TOKEN: ${{ github.token }}
174+
run: |
175+
gh workflow run publish-nix-pgupgrade-scripts.yml \
176+
-f postgresVersion="${{ steps.process_release_version.outputs.version }}"
177+
178+
- name: Trigger pg_upgrade_bin flake version workflow
179+
env:
180+
GH_TOKEN: ${{ github.token }}
181+
run: |
182+
gh workflow run publish-nix-pgupgrade-bin-flake-version.yml \
183+
-f postgresVersion="${{ steps.process_release_version.outputs.version }}"
184+
171185
- name: Slack Notification on Failure
172186
if: ${{ failure() }}
173187
uses: rtCamp/action-slack-notify@v2

.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ jobs:
2424
- name: Set PostgreSQL versions
2525
id: set-versions
2626
run: |
27-
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
27+
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
28+
MAJOR_VERSION=$(echo "${{ inputs.postgresVersion }}" | cut -d'.' -f1)
29+
VERSIONS="[\"$MAJOR_VERSION\"]"
30+
else
31+
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
32+
fi
2833
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
2934
3035
publish-staging:
@@ -43,10 +48,10 @@ jobs:
4348
- name: Grab release version
4449
id: process_release_version
4550
run: |
46-
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
47-
VERSION=$(echo "$VERSION" | tr -d '"') # Remove any surrounding quotes
4851
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
4952
VERSION="${{ inputs.postgresVersion }}"
53+
else
54+
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
5055
fi
5156
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
5257
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"
@@ -95,8 +100,11 @@ jobs:
95100
- name: Grab release version
96101
id: process_release_version
97102
run: |
98-
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
99-
VERSION=$(echo $VERSION | tr -d '"') # Remove any surrounding quotes
103+
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
104+
VERSION="${{ inputs.postgresVersion }}"
105+
else
106+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
107+
fi
100108
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
101109
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"
102110

.github/workflows/publish-nix-pgupgrade-scripts.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ jobs:
2525
steps:
2626
- name: Checkout Repo
2727
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
28-
2928
- uses: ./.github/actions/nix-install-ephemeral
30-
3129
- name: Set PostgreSQL versions
3230
id: set-versions
3331
run: |
34-
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
32+
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
33+
MAJOR_VERSION=$(echo "${{ inputs.postgresVersion }}" | cut -d'.' -f1)
34+
VERSIONS="[\"$MAJOR_VERSION\"]"
35+
else
36+
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
37+
fi
3538
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
3639
3740
publish-staging:
@@ -50,10 +53,10 @@ jobs:
5053
- name: Grab release version
5154
id: process_release_version
5255
run: |
53-
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
54-
VERSION=$(echo "$VERSION" | tr -d '"') # Remove any surrounding quotes
5556
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
5657
VERSION="${{ inputs.postgresVersion }}"
58+
else
59+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
5760
fi
5861
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
5962
@@ -101,10 +104,10 @@ jobs:
101104
- name: Grab release version
102105
id: process_release_version
103106
run: |
104-
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
105-
VERSION=$(echo "$VERSION" | tr -d '"') # Remove any surrounding quotes
106107
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
107108
VERSION="${{ inputs.postgresVersion }}"
109+
else
110+
VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
108111
fi
109112
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
110113

0 commit comments

Comments
 (0)