7
7
- release/*
8
8
paths :
9
9
- ' .github/workflows/publish-nix-pgupgrade-scripts.yml'
10
- - ' common-nix.vars.pkr.hcl'
11
10
workflow_dispatch :
12
11
inputs :
13
12
postgresVersion :
@@ -18,20 +17,40 @@ permissions:
18
17
id-token : write
19
18
20
19
jobs :
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
+
21
36
publish-staging :
37
+ needs : prepare
22
38
runs-on : ubuntu-latest
39
+ strategy :
40
+ matrix :
41
+ postgres_version : ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
23
42
24
43
steps :
25
44
- name : Checkout Repo
26
45
uses : actions/checkout@v3
27
46
47
+ - uses : DeterminateSystems/nix-installer-action@main
48
+
28
49
- name : Grab release version
29
50
id : process_release_version
30
51
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
35
54
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
36
55
37
56
- name : Create a tarball containing pg_upgrade scripts
@@ -61,20 +80,24 @@ jobs:
61
80
SLACK_FOOTER : ' '
62
81
63
82
publish-prod :
83
+ needs : prepare
64
84
runs-on : ubuntu-latest
65
85
if : github.ref_name == 'develop' || contains( github.ref, 'release' )
66
86
87
+ strategy :
88
+ matrix :
89
+ postgres_version : ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
90
+
91
+
67
92
steps :
68
93
- name : Checkout Repo
69
94
uses : actions/checkout@v3
70
95
71
96
- name : Grab release version
72
97
id : process_release_version
73
98
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
78
101
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
79
102
80
103
- name : Create a tarball containing pg_upgrade scripts
0 commit comments