77 - release/*
88 paths :
99 - ' .github/workflows/publish-nix-pgupgrade-scripts.yml'
10- - ' common-nix.vars.pkr.hcl'
1110 workflow_dispatch :
1211 inputs :
1312 postgresVersion :
@@ -18,20 +17,40 @@ permissions:
1817 id-token : write
1918
2019jobs :
20+ prepare :
21+ runs-on : ubuntu-latest
22+ outputs :
23+ postgres_versions : ${{ steps.set-versions.outputs.postgres_versions }}
24+ steps :
25+ - name : Checkout Repo
26+ uses : actions/checkout@v3
27+
28+ - uses : DeterminateSystems/nix-installer-action@main
29+
30+ - name : Set PostgreSQL versions
31+ id : set-versions
32+ run : |
33+ VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
34+ echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
35+
2136 publish-staging :
37+ needs : prepare
2238 runs-on : ubuntu-latest
39+ strategy :
40+ matrix :
41+ postgres_version : ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
2342
2443 steps :
2544 - name : Checkout Repo
2645 uses : actions/checkout@v3
2746
47+ - uses : DeterminateSystems/nix-installer-action@main
48+
2849 - name : Grab release version
2950 id : process_release_version
3051 run : |
31- VERSION=$(grep 'postgres-version' common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
32- if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
33- VERSION=${{ inputs.postgresVersion }}
34- fi
52+ VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
53+ VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
3554 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
3655
3756 - name : Create a tarball containing pg_upgrade scripts
@@ -61,20 +80,24 @@ jobs:
6180 SLACK_FOOTER : ' '
6281
6382 publish-prod :
83+ needs : prepare
6484 runs-on : ubuntu-latest
6585 if : github.ref_name == 'develop' || contains( github.ref, 'release' )
6686
87+ strategy :
88+ matrix :
89+ postgres_version : ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
90+
91+
6792 steps :
6893 - name : Checkout Repo
6994 uses : actions/checkout@v3
7095
7196 - name : Grab release version
7297 id : process_release_version
7398 run : |
74- VERSION=$(grep 'postgres-version' common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
75- if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
76- VERSION=${{ inputs.postgresVersion }}
77- fi
99+ VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
100+ VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
78101 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
79102
80103 - name : Create a tarball containing pg_upgrade scripts
0 commit comments