Skip to content

Commit 578be5d

Browse files
authored
Revert "feat: add branch-based versioning for PR AMI builds (#1902)" (#1905)
This reverts commit 6271465.
1 parent 071731d commit 578be5d

File tree

3 files changed

+17
-30
lines changed

3 files changed

+17
-30
lines changed

.github/actionlint.yml

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

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
id: set-versions
3737
run: |
3838
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
39-
echo "postgres_versions=$VERSIONS" >> "$GITHUB_OUTPUT"
39+
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
4040
4141
build:
4242
needs: prepare
@@ -67,21 +67,25 @@ jobs:
6767
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
6868
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
6969
70+
- name: Run checks if triggered manually
71+
if: ${{ github.event_name == 'workflow_dispatch' }}
72+
run: |
73+
SUFFIX=$(nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
74+
if [[ -z "$SUFFIX" ]] ; then
75+
echo "Version must include non-numeric characters if built manually."
76+
exit 1
77+
fi
78+
7079
- name: Set PostgreSQL version environment variable
7180
run: |
72-
echo "POSTGRES_MAJOR_VERSION=${{ matrix.postgres_version }}" >> "$GITHUB_ENV"
73-
echo "EXECUTION_ID=${{ github.run_id }}-${{ matrix.postgres_version }}" >> "$GITHUB_ENV"
81+
echo "POSTGRES_MAJOR_VERSION=${{ matrix.postgres_version }}" >> $GITHUB_ENV
82+
echo "EXECUTION_ID=${{ github.run_id }}-${{ matrix.postgres_version }}" >> $GITHUB_ENV
7483
7584
- name: Generate common-nix.vars.pkr.hcl
7685
run: |
77-
PG_VERSION="$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)"
78-
BRANCH_NAME="$(echo "${{ github.ref }}" | sed 's|refs/heads/||')"
79-
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "$BRANCH_NAME" != "develop" && "$BRANCH_NAME" != release/* ]]; then
80-
SUFFIX="${BRANCH_NAME//[^a-zA-Z0-9._-]/-}-${{ github.run_id }}"
81-
PG_VERSION="${PG_VERSION}-${SUFFIX}"
82-
echo "Added branch suffix to version: $SUFFIX"
83-
fi
84-
echo "postgres-version = \"$PG_VERSION\"" > common-nix.vars.pkr.hcl
86+
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
87+
PG_VERSION=$(echo "$PG_VERSION" | tr -d '"') # Remove any surrounding quotes
88+
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
8589
# Ensure there's a newline at the end of the file
8690
echo "" >> common-nix.vars.pkr.hcl
8791
@@ -106,9 +110,8 @@ jobs:
106110
- name: Grab release version
107111
id: process_release_version
108112
run: |
109-
VERSION=$(sed -e 's/postgres-version = "\(.*\)"/\1/g' common-nix.vars.pkr.hcl)
110-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
111-
echo "::notice title=AMI Published::Postgres AMI version: $VERSION"
113+
VERSION=$(cat common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
114+
echo "version=$VERSION" >> $GITHUB_OUTPUT
112115
113116
- name: Create nix flake revision tarball
114117
run: |

nix/hooks.nix

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{ inputs, ... }:
2-
let
3-
ghWorkflows = builtins.attrNames (builtins.readDir ../.github/workflows);
4-
lintedWorkflows = [ "ami-release-nix.yml" ];
5-
in
62
{
73
imports = [ inputs.git-hooks.flakeModule ];
84
perSystem =
@@ -12,17 +8,9 @@ in
128
check.enable = true;
139
settings = {
1410
hooks = {
15-
actionlint = {
16-
enable = true;
17-
excludes = builtins.filter (name: !builtins.elem name lintedWorkflows) ghWorkflows;
18-
verbose = true;
19-
};
20-
2111
treefmt = {
2212
enable = true;
2313
package = config.treefmt.build.wrapper;
24-
pass_filenames = false;
25-
verbose = true;
2614
};
2715
};
2816
};

0 commit comments

Comments
 (0)