From 5939462f20ae563198a5a86015e8d3324b2e975e Mon Sep 17 00:00:00 2001 From: Hein Date: Mon, 12 Oct 2026 19:32:20 +0200 Subject: [PATCH] feat(release): add source archive creation to release workflow --- .gitea/workflows/release.yml | 35 ++++++++++++++----- Makefile | 4 +-- ...com.intellij.database-DB-243.21565.204.xml | 8 ++--- ...intellij.modules.json-DB-243.21565.204.xml | 2 +- ...tellij.grid.core.impl-DB-243.21565.204.xml | 2 +- linux/arch/{ => pgtidy-bin}/PKGBUILD | 0 linux/arch/pgtidy/PKGBUILD | 32 +++++++++++++++++ 7 files changed, 67 insertions(+), 16 deletions(-) rename linux/arch/{ => pgtidy-bin}/PKGBUILD (100%) create mode 100644 linux/arch/pgtidy/PKGBUILD diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 2ba1a3f..78875b6 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -65,6 +65,13 @@ jobs: fi done + - name: Build source archives + run: | + TAG="${{ github.event.inputs.tag || github.ref_name }}" + PREFIX="pgtidy-${TAG#v}" + git archive --format=tar.gz --prefix="${PREFIX}/" -o "pgtidy-${TAG}-source.tar.gz" "$TAG" + git archive --format=zip --prefix="${PREFIX}/" -o "pgtidy-${TAG}-source.zip" "$TAG" + - name: Create release and upload binaries run: | set -euo pipefail @@ -255,9 +262,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} pkg-aur: - name: AUR package + name: AUR package (${{ matrix.pkg }}) needs: release runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + pkg: [pgtidy-bin, pgtidy] steps: - uses: actions/checkout@v4 @@ -268,6 +279,7 @@ jobs: set -euo pipefail VERSION="${{ github.event.inputs.tag || github.ref_name }}" PKGVER="${VERSION#v}" + PKG="${{ matrix.pkg }}" AUR_KEY_PATH="$HOME/.ssh/aur" AUR_KNOWN_HOSTS="$HOME/.ssh/known_hosts" @@ -299,7 +311,7 @@ jobs: chmod 644 "$AUR_KNOWN_HOSTS" GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$AUR_KNOWN_HOSTS -i $AUR_KEY_PATH" \ - git clone ssh://aur@aur.archlinux.org/pgtidy-bin.git aur-repo + git clone "ssh://aur@aur.archlinux.org/${PKG}.git" aur-repo if [ -f aur-repo/PKGBUILD ]; then CURRENT_PKGVER=$(awk -F= '/^pkgver=/ {print $2; exit}' aur-repo/PKGBUILD | tr -d "[:space:]") @@ -315,16 +327,23 @@ jobs: PKGREL=1 fi - echo "Publishing pgtidy-bin ${PKGVER}-${PKGREL} to AUR" + echo "Publishing ${PKG} ${PKGVER}-${PKGREL} to AUR" - SHA_AMD64=$(curl -fsSL "https://git.warky.dev/wdevs/pgtidy/releases/download/v${PKGVER}/pgtidy_${PKGVER}_linux_amd64.tar.gz" | sha256sum | cut -d' ' -f1) - SHA_ARM64=$(curl -fsSL "https://git.warky.dev/wdevs/pgtidy/releases/download/v${PKGVER}/pgtidy_${PKGVER}_linux_arm64.tar.gz" | sha256sum | cut -d' ' -f1) + DL="https://git.warky.dev/wdevs/pgtidy/releases/download/v${PKGVER}" + if [ "$PKG" = "pgtidy-bin" ]; then + SHA_AMD64=$(curl -fsSL "${DL}/pgtidy_${PKGVER}_linux_amd64.tar.gz" | sha256sum | cut -d' ' -f1) + SHA_ARM64=$(curl -fsSL "${DL}/pgtidy_${PKGVER}_linux_arm64.tar.gz" | sha256sum | cut -d' ' -f1) + SUMS=(-e "s/^sha256sums_x86_64=.*/sha256sums_x86_64=('${SHA_AMD64}')/" \ + -e "s/^sha256sums_aarch64=.*/sha256sums_aarch64=('${SHA_ARM64}')/") + else + SHA_SRC=$(curl -fsSL "${DL}/pgtidy-v${PKGVER}-source.tar.gz" | sha256sum | cut -d' ' -f1) + SUMS=(-e "s/^sha256sums=.*/sha256sums=('${SHA_SRC}')/") + fi sed -e "s/^pkgver=.*/pkgver=${PKGVER}/" \ -e "s/^pkgrel=.*/pkgrel=${PKGREL}/" \ - -e "s/^sha256sums_x86_64=.*/sha256sums_x86_64=('${SHA_AMD64}')/" \ - -e "s/^sha256sums_aarch64=.*/sha256sums_aarch64=('${SHA_ARM64}')/" \ - linux/arch/PKGBUILD > aur-repo/PKGBUILD + "${SUMS[@]}" \ + "linux/arch/${PKG}/PKGBUILD" > aur-repo/PKGBUILD CID=$(docker run -d archlinux:latest sleep infinity) cleanup_docker() { docker rm -f "$CID" >/dev/null 2>&1 || true; } diff --git a/Makefile b/Makefile index 5ff1939..90a93e2 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,9 @@ release: NEXT="v$$MAJOR.$$MINOR.$$((PATCH + 1))"; \ PKGVER="$$MAJOR.$$MINOR.$$((PATCH + 1))"; \ echo "Current: $$CURRENT → Next: $$NEXT"; \ - sed -i "s/^pkgver=.*/pkgver=$$PKGVER/" linux/arch/PKGBUILD; \ + sed -i "s/^pkgver=.*/pkgver=$$PKGVER/" linux/arch/pgtidy-bin/PKGBUILD linux/arch/pgtidy/PKGBUILD; \ sed -i "s/^Version:.*/Version: $$PKGVER/" linux/centos/pgtidy.spec; \ - git add linux/arch/PKGBUILD linux/centos/pgtidy.spec; \ + git add linux/arch/pgtidy-bin/PKGBUILD linux/arch/pgtidy/PKGBUILD linux/centos/pgtidy.spec; \ git commit -m "chore(release): bump version to $$PKGVER"; \ git tag -a "$$NEXT" -m "Release $$NEXT"; \ git push origin HEAD "$$NEXT"; \ diff --git a/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.database-DB-243.21565.204.xml b/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.database-DB-243.21565.204.xml index 9f97ebe..e7a3772 100644 --- a/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.database-DB-243.21565.204.xml +++ b/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.database-DB-243.21565.204.xml @@ -4,13 +4,13 @@ - - - + + - + + diff --git a/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.modules.json-DB-243.21565.204.xml b/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.modules.json-DB-243.21565.204.xml index 9c26b7f..a43b757 100644 --- a/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.modules.json-DB-243.21565.204.xml +++ b/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.modules.json-DB-243.21565.204.xml @@ -4,8 +4,8 @@ - + \ No newline at end of file diff --git a/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-intellij.grid.core.impl-DB-243.21565.204.xml b/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-intellij.grid.core.impl-DB-243.21565.204.xml index 868a519..7ffec8c 100644 --- a/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-intellij.grid.core.impl-DB-243.21565.204.xml +++ b/editors/datagrip/.intellijPlatform/localPlatformArtifacts/bundledPlugin-intellij.grid.core.impl-DB-243.21565.204.xml @@ -4,8 +4,8 @@ - + \ No newline at end of file diff --git a/linux/arch/PKGBUILD b/linux/arch/pgtidy-bin/PKGBUILD similarity index 100% rename from linux/arch/PKGBUILD rename to linux/arch/pgtidy-bin/PKGBUILD diff --git a/linux/arch/pgtidy/PKGBUILD b/linux/arch/pgtidy/PKGBUILD new file mode 100644 index 0000000..819c17b --- /dev/null +++ b/linux/arch/pgtidy/PKGBUILD @@ -0,0 +1,32 @@ +# Maintainer: Hein (Warky Devs) +pkgname=pgtidy +pkgver=0.0.9 +pkgrel=1 +pkgdesc="PostgreSQL SQL formatter and linter" +arch=('x86_64' 'aarch64') +url="https://git.warky.dev/wdevs/pgtidy" +license=('MIT') +makedepends=('go') +conflicts=('pgtidy-bin') +source=("$pkgname-$pkgver.tar.gz::$url/releases/download/v$pkgver/pgtidy-v$pkgver-source.tar.gz") +sha256sums=('SKIP') + +build() { + cd "$pkgname-$pkgver" + export CGO_ENABLED=0 + go build \ + -trimpath \ + -ldflags "-X main.version=v$pkgver" \ + -o "$pkgname" ./cmd/pgtidy +} + +check() { + cd "$pkgname-$pkgver" + go test ./... +} + +package() { + cd "$pkgname-$pkgver" + install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname" + install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +}