From 1dc231d1623c6665dcb256147774a053c7961dcc Mon Sep 17 00:00:00 2001
From: Roi Klevansky <roiklevansky@gmail.com>
Date: Sat, 12 Oct 2024 19:06:20 +0300
Subject: [PATCH 1/3] build: add packing of artifacts to Makefile

---
 Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index a38467c..d946ad2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
 ARCHS := x86_64 arm aarch64 powerpc
 TARGETS := $(addprefix build-, $(ARCHS))
+PACK_TARGETS := $(addprefix pack-, $(ARCHS))
 
-.PHONY: clean help download_packages build patch-gdb build-docker-image $(TARGETS)
+.PHONY: clean help download_packages build patch-gdb build-docker-image $(TARGETS) $(PACK_TARGETS)
 
 help:
 	@echo "Usage:"
@@ -47,6 +48,13 @@ $(TARGETS): build-%: download-packages patch-gdb build-docker-image
 		--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
 		/app/gdb/src/build.sh $* /app/gdb/build/ /app/gdb/src/gdb_static.patch
 
+pack: $(PACK_TARGETS)
+
+$(PACK_TARGETS): pack-%: build-%
+	if [ ! -f "build/artifacts/gdb-static-$*.tar.gz" ]; then \
+		tar -czf "build/artifacts/gdb-static-$*.tar.gz" -C "build/artifacts/$*" .; \
+	fi
+
 clean:
 	rm -rf build
 # Kill and remove all containers of image gdb-static

From 7697e5c2e1a95b3bc48c434f82f76a12fd04fd37 Mon Sep 17 00:00:00 2001
From: Roi Klevansky <roiklevansky@gmail.com>
Date: Sat, 12 Oct 2024 19:05:52 +0300
Subject: [PATCH 2/3] build(ci/cd): add basic Github workflow pipeline

---
 .github/workflows/pipeline.yaml | 37 +++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 .github/workflows/pipeline.yaml

diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml
new file mode 100644
index 0000000..4a4e748
--- /dev/null
+++ b/.github/workflows/pipeline.yaml
@@ -0,0 +1,37 @@
+name: gdb-static-pipeline
+
+on:
+  pull_request:
+    branches:
+      - '*'
+  push:
+    tags:
+      - 'v*'
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: Install dependencies
+      run: sudo apt-get install -y wget
+
+    - name: Build
+      run: make build -j$((`nproc`+1))
+
+    - name: Pack
+      run: make pack
+
+    - name: Upload artifact
+      uses: actions/upload-artifact@v4
+      with:
+        name: gdb-static
+        path: build/artifacts/gdb-static*.tar.gz
+
+    - name: Publish release
+      if: github.event_name == 'push'
+      uses: softprops/action-gh-release@v2
+      with:
+        files: build/artifacts/gdb-static*.tar.gz

From fe4ad583aea2b1fbbf5a8430d95578c8680ad1c3 Mon Sep 17 00:00:00 2001
From: Roi Klevansky <roiklevansky@gmail.com>
Date: Sat, 12 Oct 2024 19:33:33 +0300
Subject: [PATCH 3/3] fix: move all package links to GNU FTP

---
 src/download_packages.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/download_packages.sh b/src/download_packages.sh
index e1488cd..84634cb 100755
--- a/src/download_packages.sh
+++ b/src/download_packages.sh
@@ -7,8 +7,8 @@ script_dir=$(dirname "$0")
 # List of package URLs to download
 PACKAGE_URLS=(
     "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz"
-    "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz"
-    "https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.xz"
+    "https://ftp.gnu.org/pub/gnu/gmp/gmp-6.3.0.tar.xz"
+    "https://ftp.gnu.org/pub/gnu/mpfr/mpfr-4.2.1.tar.xz"
     "https://ftp.gnu.org/gnu/gdb/gdb-15.1.tar.xz"
 )