Skip to content

Commit ee89cc2

Browse files
committed
feat: gen common vars hcl file
1 parent 7ba55bf commit ee89cc2

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
name: Release all major versions on Dockerhub
1+
name: Release PostgreSQL Images on Dockerhub
22

33
on:
44
push:
55
branches:
66
- develop
77
- release/*
8-
- sam/docker-oriole17
98
paths:
10-
- ".github/workflows/dockerhub-release-matrix.yml"
11-
- "anisble/vars.yml"
9+
- ".github/workflows/dockerhub-release.yml"
10+
- "common-nix.vars*"
11+
- "ansible/vars.yml"
12+
- "Dockerfile-*"
1213
workflow_dispatch:
13-
14+
1415
jobs:
1516
prepare:
1617
runs-on: ubuntu-latest
@@ -70,8 +71,30 @@ jobs:
7071
build_args: ${{ steps.args.outputs.result }}
7172
steps:
7273
- uses: actions/checkout@v3
74+
75+
- uses: DeterminateSystems/nix-installer-action@main
76+
77+
- name: Set PostgreSQL version environment variable
78+
run: echo "POSTGRES_MAJOR_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
79+
80+
- name: Generate common-nix.vars.pkr.hcl
81+
run: |
82+
# For orioledb versions, we need to handle the version lookup differently
83+
if [[ "${{ matrix.version }}" == "orioledb-"* ]]; then
84+
MAJOR_VERSION="${{ matrix.version #orioledb-}}"
85+
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'$MAJOR_VERSION'_orioledb"]' ansible/vars.yml)
86+
else
87+
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres${{ matrix.version }}"]' ansible/vars.yml)
88+
fi
89+
90+
PG_VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
91+
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
92+
# Ensure there's a newline at the end of the file
93+
echo "" >> common-nix.vars.pkr.hcl
94+
7395
- id: settings
7496
run: sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT
97+
7598
- id: args
7699
uses: mikefarah/yq@master
77100
with:

0 commit comments

Comments
 (0)