From acaf9b5a7f1d4b8cedb9c9e5819acd6ffa713be3 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:57:43 -0500 Subject: [PATCH 01/26] Add new build configuration for static Linux AMD64 target and optimize build settings. --- .github/workflows/main.yml | 17 +++++++++++++++++ default.nix | 9 ++++++++- flake.nix | 12 ++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 42ea09a..ae58405 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,6 +8,7 @@ concurrency: jobs: build: + if: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -20,6 +21,7 @@ jobs: - run: nix build template: + if: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -36,3 +38,18 @@ jobs: working-directory: ${{ steps.mktemp.outputs.tmpdir }} - run: cat .pre-commit-config.yaml working-directory: ${{ steps.mktemp.outputs.tmpdir }} + + release: + runs-on: ubuntu-latest + # needs: [build, template] + strategy: + matrix: + package: + - static-linux-amd64 + fail-fast: true + steps: + - uses: actions/checkout@v5 + - uses: cachix/install-nix-action@v31 + - run: nix build .#static-linux-amd64 + - run: file ./result/bin/autocommitmsg + - run: ldd ./result/bin/autocommitmsg diff --git a/default.nix b/default.nix index 8172922..4af3837 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,12 @@ -{ pkgs, lib }: +{ + pkgs, + lib, + ldflags ? [ ], + ... +}@attrs: pkgs.buildGoApplication { + inherit ldflags; pname = "autocommitmsg"; version = lib.trim (builtins.readFile ./version.txt); src = ./.; @@ -11,3 +17,4 @@ pkgs.buildGoApplication { mainProgram = "autocommitmsg"; }; } +// attrs diff --git a/flake.nix b/flake.nix index e980664..63e28be 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,18 @@ in { default = pkgs.callPackage ./default.nix { }; + static-linux-amd64 = pkgs.callPackage ./default.nix { + CGO_ENABLED = 0; + GOOS = "linux"; + GOARCH = "amd64"; + ldflags = [ "-extldflags '-static'" ]; + }; + static-linux-arm64 = pkgs.callPackage ./default.nix { + CGO_ENABLED = 0; + GOOS = "linux"; + GOARCH = "arm64"; + ldflags = [ "-extldflags '-static'" ]; + }; } ); From 5922b6949a0d419ff10e770cba5927789a6df2e0 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:59:01 -0500 Subject: [PATCH 02/26] Add static-linux-arm64 to the package matrix in the GitHub Actions workflow. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ae58405..cfc94c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,7 @@ jobs: matrix: package: - static-linux-amd64 + - static-linux-arm64 fail-fast: true steps: - uses: actions/checkout@v5 From 4a47abdcf4d0d4c6a88addba0e8bddb8598aec4c Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:02:46 -0500 Subject: [PATCH 03/26] Update GitHub Actions workflow to build Go project instead of using Nix package. --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfc94c9..742fc1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,7 +50,7 @@ jobs: fail-fast: true steps: - uses: actions/checkout@v5 - - uses: cachix/install-nix-action@v31 - - run: nix build .#static-linux-amd64 - - run: file ./result/bin/autocommitmsg - - run: ldd ./result/bin/autocommitmsg + - uses: actions/setup-go@v6 + - run: go build + - run: file autocommitmsg + - run: ldd autocommitmsg From 34fb70dcee0210d7a4066320bb9a59f49a22dde4 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:03:49 -0500 Subject: [PATCH 04/26] Refactor workflow configuration file to remove unused matrix strategy block --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 742fc1a..e01a2a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,12 +42,12 @@ jobs: release: runs-on: ubuntu-latest # needs: [build, template] - strategy: - matrix: - package: - - static-linux-amd64 - - static-linux-arm64 - fail-fast: true + # strategy: + # matrix: + # package: + # - static-linux-amd64 + # - static-linux-arm64 + # fail-fast: true steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 From a12099d45405638efcf13810c7de620237ce2783 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:05:48 -0500 Subject: [PATCH 05/26] Update Go version to 1.25 in GitHub Actions workflow file. --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e01a2a9..759e25d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,6 +51,8 @@ jobs: steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 + with: + go-version: 1.25 - run: go build - run: file autocommitmsg - run: ldd autocommitmsg From 98175614d57709bbdc0f96fc4fb3198f3a87e9b0 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:11:08 -0500 Subject: [PATCH 06/26] Refactor how Go build is executed and add matrix strategy in release job --- .github/workflows/main.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 759e25d..2da3757 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,17 +42,23 @@ jobs: release: runs-on: ubuntu-latest # needs: [build, template] - # strategy: - # matrix: - # package: - # - static-linux-amd64 - # - static-linux-arm64 - # fail-fast: true + strategy: + matrix: + goos: + # - darwin + - linux + goarch: + - amd64 + - arm64 + fail-fast: true steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version: 1.25 - run: go build + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} - run: file autocommitmsg - run: ldd autocommitmsg From 0e1d284659e55eb59bb83ae10c3fc6a8fefabc0c Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:12:21 -0500 Subject: [PATCH 07/26] Add CGO_ENABLED: 0 to the Go environment variables. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2da3757..b2e0944 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,5 +60,6 @@ jobs: env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} + CGO_ENABLED: 0 - run: file autocommitmsg - run: ldd autocommitmsg From 5f7575666ba94ff056566e446acbee72f0e461b3 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:14:14 -0500 Subject: [PATCH 08/26] Remove unnecessary ldd command from workflow config --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2e0944..246aa1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,4 +62,3 @@ jobs: GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 - run: file autocommitmsg - - run: ldd autocommitmsg From da91b54b21ecdd62980235fb1d098372fea1f033 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:16:25 -0500 Subject: [PATCH 09/26] Update Go version in GitHub actions workflow to read from go.mod file. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 246aa1e..90d3398 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,7 @@ jobs: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: - go-version: 1.25 + go-version-file: go.mod - run: go build env: GOOS: ${{ matrix.goos }} From bb3994e59a6b1bd9fe6a1553a5e0388a74235166 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:17:03 -0500 Subject: [PATCH 10/26] Fix goos configuration in main.yml file --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90d3398..376a0e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: strategy: matrix: goos: - # - darwin + - darwin - linux goarch: - amd64 From f5a49fc6b9638eea4cb5bfacd24eef9f27dde728 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:49:35 -0500 Subject: [PATCH 11/26] refactor: Rename release job to binaries The 'release' job has been renamed to 'binaries' to better reflect its purpose of building binary artifacts for different platforms. Additionally, the build output filename has been changed to include a prefix derived from the Git ref name, operating system, and architecture. A zip archive is now created containing the binary and the LICENSE file. --- .github/workflows/main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 376a0e2..a3fd923 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: - run: cat .pre-commit-config.yaml working-directory: ${{ steps.mktemp.outputs.tmpdir }} - release: + binaries: runs-on: ubuntu-latest # needs: [build, template] strategy: @@ -51,14 +51,19 @@ jobs: - amd64 - arm64 fail-fast: true + env: + NAME_PREFIX: autocommitmsg-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version-file: go.mod - - run: go build + - run: go build -o $NAME_PREFIX/autocommitmsg env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 - - run: file autocommitmsg + - run: | + cp LICENSE $NAME_PREFIX/ + zip -r $NAME_PREFIX.zip $NAME_PREFIX + From 5f41e6d98743c70dea3fdcb04e6e74f5eacd72e2 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:58:37 -0500 Subject: [PATCH 12/26] build: Add pre-release job to create a draft GitHub release --- .github/workflows/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3fd923..9b7f991 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,4 +66,17 @@ jobs: - run: | cp LICENSE $NAME_PREFIX/ zip -r $NAME_PREFIX.zip $NAME_PREFIX + - uses: actions/upload-artifact@v4 + with: + path: $NAME_PREFIX.zip + + pre-release: + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v5 + - uses: softprops/action-gh-release@v2 + with: + draft: true + generate_release_notes: true + files: From 7697ebbbc62bd9dc297e354e5b4c7fe94c933708 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:59:17 -0500 Subject: [PATCH 13/26] fix: Add dependency on binaries job for pre-release The pre-release job should only run after the binaries job has completed successfully. This ensures that the release artifacts are available before attempting to create a release. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b7f991..24f3338 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,6 +72,7 @@ jobs: pre-release: runs-on: ubuntu-latest + needs: [binaries] steps: - uses: actions/download-artifact@v5 - uses: softprops/action-gh-release@v2 From 823745d31a6c2f32005338ed84a8aac52b69ac61 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:02:59 -0500 Subject: [PATCH 14/26] refactor: Improve release workflow - Split zip creation into a separate step for better clarity. - Rename the `pre-release` job to `draft-release` to more accurately reflect its purpose. - Add `permissions` to the `draft-release` job to allow writing to contents. - Explicitly specify `files: *.zip` in the `action-gh-release` step. --- .github/workflows/main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24f3338..95bcdaf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,21 +63,22 @@ jobs: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 - - run: | - cp LICENSE $NAME_PREFIX/ - zip -r $NAME_PREFIX.zip $NAME_PREFIX + - run: cp LICENSE $NAME_PREFIX/ + - run: zip -r $NAME_PREFIX.zip $NAME_PREFIX - uses: actions/upload-artifact@v4 with: path: $NAME_PREFIX.zip - pre-release: + draft-release: runs-on: ubuntu-latest needs: [binaries] + permissions: + contents: write steps: - uses: actions/download-artifact@v5 - uses: softprops/action-gh-release@v2 with: draft: true generate_release_notes: true - files: + files: *.zip From 4691075341407262a3fc8df745a48e8bedc2f90b Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:04:34 -0500 Subject: [PATCH 15/26] build: add LICENSE to release artifacts The LICENSE file should be included in the release artifacts to provide users with the licensing information. --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 95bcdaf..d7ec0a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,10 +75,13 @@ jobs: permissions: contents: write steps: + - uses: actions/checkout@v5 - uses: actions/download-artifact@v5 - uses: softprops/action-gh-release@v2 with: draft: true generate_release_notes: true - files: *.zip + files: | + *.zip + LICENSE From 9452a642968a40a21d59e2c4c7b006c2ba6fd614 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:06:53 -0500 Subject: [PATCH 16/26] ci: Adjust artifact upload path and error handling The artifact upload path was changed from a specific zip file to a wildcard "*.zip" to accommodate potential future changes or multiple zip files. Additionally, the `if-no-files-found` option was set to "error" to ensure that the workflow fails if no zip files are found, preventing unexpected behavior. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7ec0a5..0586dc3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,7 +67,8 @@ jobs: - run: zip -r $NAME_PREFIX.zip $NAME_PREFIX - uses: actions/upload-artifact@v4 with: - path: $NAME_PREFIX.zip + path: "*.zip" + if-no-files-found: error draft-release: runs-on: ubuntu-latest From 80448fcd6e68d4f4759dd71ff72abaf4dbc7885e Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:08:28 -0500 Subject: [PATCH 17/26] ci: Configure artifact upload with name and specific file path The artifact upload action was previously configured to upload all `.zip` files. This commit changes the configuration to upload a specific artifact with the name `${{ env.NAME_PREFIX }}` and the path `${{ env.NAME_PREFIX }}.zip`. This ensures that only the intended artifact is uploaded. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0586dc3..6405df9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,7 +67,8 @@ jobs: - run: zip -r $NAME_PREFIX.zip $NAME_PREFIX - uses: actions/upload-artifact@v4 with: - path: "*.zip" + name: ${{ env.NAME_PREFIX }} + path: ${{ env.NAME_PREFIX }}.zip if-no-files-found: error draft-release: From c2075dc4be4e3f84cecb24d705131447d6aac2ee Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:11:53 -0500 Subject: [PATCH 18/26] fix: Configure retention-days for artifact and update glob pattern for release The `retention-days` for the artifact has been set to 1 to ensure that artifacts are not kept indefinitely. The glob pattern for the release has been updated from `*.zip` to `**/*.zip` to correctly include zip files in subdirectories. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6405df9..bf4c82c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,6 +70,7 @@ jobs: name: ${{ env.NAME_PREFIX }} path: ${{ env.NAME_PREFIX }}.zip if-no-files-found: error + retention-days: 1 draft-release: runs-on: ubuntu-latest @@ -84,6 +85,6 @@ jobs: draft: true generate_release_notes: true files: | - *.zip + **/*.zip LICENSE From 575a9481515e16f24aaaf8766c983162b33d36b2 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:18:46 -0500 Subject: [PATCH 19/26] refactor(ci): rename 'binaries' job to 'binary' Renames the 'binaries' job to 'binary' in the GitHub Actions workflow file to better reflect its singular purpose. Also removes unnecessary file glob patterns from the `draft-release` job's `files` input, as the default behavior is sufficient. --- .github/workflows/main.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf4c82c..f2a2fa8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: - run: cat .pre-commit-config.yaml working-directory: ${{ steps.mktemp.outputs.tmpdir }} - binaries: + binary: runs-on: ubuntu-latest # needs: [build, template] strategy: @@ -74,7 +74,7 @@ jobs: draft-release: runs-on: ubuntu-latest - needs: [binaries] + needs: [binary] permissions: contents: write steps: @@ -84,7 +84,4 @@ jobs: with: draft: true generate_release_notes: true - files: | - **/*.zip - LICENSE - + files: **/*.zip From 03808096628f3e07315d839f708aa8dba6604c54 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:19:44 -0500 Subject: [PATCH 20/26] fix: Quote glob pattern in release workflow --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2a2fa8..818aa9c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -84,4 +84,4 @@ jobs: with: draft: true generate_release_notes: true - files: **/*.zip + files: "**/*.zip" From dddce1dbe8c2ca25c16b87a9fd2e039e4f81233f Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:33:38 -0500 Subject: [PATCH 21/26] fix: Remove condition preventing build job from running The `if: false` condition was preventing the build job from executing. This commit removes that condition, allowing the build job to run as intended. Additionally, the `needs` section for the `binary` job has been updated to explicitly list the `build` and `template` jobs it depends on. --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 818aa9c..52584b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,6 @@ concurrency: jobs: build: - if: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -41,7 +40,9 @@ jobs: binary: runs-on: ubuntu-latest - # needs: [build, template] + needs: + - build + - template strategy: matrix: goos: From 76d4a23d0166d09fd5189a6eb9f822b2f4033c23 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:40:38 -0500 Subject: [PATCH 22/26] refactor: rename main workflow to build and add release workflow The main CI workflow has been renamed from `main.yml` to `build.yml` to better reflect its purpose. A new workflow, `release.yml`, has been added to handle the creation and drafting of releases. This new workflow is triggered by new git tags and builds binaries for different operating systems and architectures, then uploads them as artifacts. Finally, it uses the `softprops/action-gh-release` action to create a draft release with generated notes and attached artifacts. --- .github/workflows/{main.yml => build.yml} | 3 +- .github/workflows/release.yml | 59 +++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) rename .github/workflows/{main.yml => build.yml} (99%) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/build.yml similarity index 99% rename from .github/workflows/main.yml rename to .github/workflows/build.yml index 52584b7..b1f316e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Main +name: Build on: push @@ -20,7 +20,6 @@ jobs: - run: nix build template: - if: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..63d699e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + push: + tags: ["v*"] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + binary: + runs-on: ubuntu-latest + needs: + - build + - template + strategy: + matrix: + goos: + - darwin + - linux + goarch: + - amd64 + - arm64 + fail-fast: true + env: + NAME_PREFIX: autocommitmsg-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + - run: go build -o $NAME_PREFIX/autocommitmsg + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + CGO_ENABLED: 0 + - run: cp LICENSE $NAME_PREFIX/ + - run: zip -r $NAME_PREFIX.zip $NAME_PREFIX + - uses: actions/upload-artifact@v4 + with: + name: ${{ env.NAME_PREFIX }} + path: ${{ env.NAME_PREFIX }}.zip + if-no-files-found: error + retention-days: 1 + + draft-release: + runs-on: ubuntu-latest + needs: [binary] + permissions: + contents: write + steps: + - uses: actions/checkout@v5 + - uses: actions/download-artifact@v5 + - uses: softprops/action-gh-release@v2 + with: + draft: true + generate_release_notes: true + files: "**/*.zip" From b18e0f4e5599d2dc2c286a4b101cc3b837e7ae07 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:47:16 -0500 Subject: [PATCH 23/26] docs: update workflow badges Update the badges in the README to reflect the new workflow names: "Build" and "Release" instead of "Main". --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61b6ae4..9c6fb6c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # autocommitmsg -[![Main](https://github.com/sestrella/autocommitmsg/actions/workflows/main.yml/badge.svg)](https://github.com/sestrella/autocommitmsg/actions/workflows/main.yml) +[![Build](https://github.com/sestrella/autocommitmsg/actions/workflows/build.yml/badge.svg)](https://github.com/sestrella/autocommitmsg/actions/workflows/build.yml) +[![Release](https://github.com/sestrella/autocommitmsg/actions/workflows/release.yml/badge.svg)](https://github.com/sestrella/autocommitmsg/actions/workflows/release.yml) Generates a commit message from a `git diff` using AI. From 7693c72e3ca9fc66450377811a07d439a54454f3 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:51:31 -0500 Subject: [PATCH 24/26] refactor: Remove unused binary and draft-release jobs The `binary` and `draft-release` jobs were previously used for building and releasing binaries. These jobs are no longer necessary as the project does not require them at this time. Removing them simplifies the build workflow and reduces unnecessary CI/CD activity. --- .github/workflows/build.yml | 49 ------------------------------------- 1 file changed, 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1f316e..84b3ec3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,52 +36,3 @@ jobs: working-directory: ${{ steps.mktemp.outputs.tmpdir }} - run: cat .pre-commit-config.yaml working-directory: ${{ steps.mktemp.outputs.tmpdir }} - - binary: - runs-on: ubuntu-latest - needs: - - build - - template - strategy: - matrix: - goos: - - darwin - - linux - goarch: - - amd64 - - arm64 - fail-fast: true - env: - NAME_PREFIX: autocommitmsg-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - - run: go build -o $NAME_PREFIX/autocommitmsg - env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} - CGO_ENABLED: 0 - - run: cp LICENSE $NAME_PREFIX/ - - run: zip -r $NAME_PREFIX.zip $NAME_PREFIX - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.NAME_PREFIX }} - path: ${{ env.NAME_PREFIX }}.zip - if-no-files-found: error - retention-days: 1 - - draft-release: - runs-on: ubuntu-latest - needs: [binary] - permissions: - contents: write - steps: - - uses: actions/checkout@v5 - - uses: actions/download-artifact@v5 - - uses: softprops/action-gh-release@v2 - with: - draft: true - generate_release_notes: true - files: "**/*.zip" From 5fb543b274f99d49897496c4db977ace11572b48 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:54:22 -0500 Subject: [PATCH 25/26] fix: Update autocommitmsg repository name in build workflow The repository name in the `build.yml` workflow was incorrectly set to `auto-commit-msg`. This commit corrects it to `autocommitmsg` to match the actual repository name. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84b3ec3..d46fbee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v5 - uses: cachix/install-nix-action@v31 - run: nix profile add nixpkgs#devenv - - run: sed -i 's/github:sestrella\/auto-commit-msg/github:sestrella\/auto-commit-msg?ref=${{ github.sha }}/g' templates/default/devenv.yaml + - run: sed -i 's/github:sestrella\/autocommitmsg/github:sestrella\/autocommitmsg?ref=${{ github.sha }}/g' templates/default/devenv.yaml - run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT" id: mktemp - run: git init From 7d4e4e5604495ef4e68c08078a37d91a5e0439c1 Mon Sep 17 00:00:00 2001 From: Sebastian Estrella <2049686+sestrella@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:59:19 -0500 Subject: [PATCH 26/26] refactor: Remove static build configurations The static build configurations for different architectures were removed from the flake.nix file. The default build process in default.nix is now responsible for handling these builds. --- default.nix | 9 +-------- flake.nix | 12 ------------ 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/default.nix b/default.nix index 4af3837..8172922 100644 --- a/default.nix +++ b/default.nix @@ -1,12 +1,6 @@ -{ - pkgs, - lib, - ldflags ? [ ], - ... -}@attrs: +{ pkgs, lib }: pkgs.buildGoApplication { - inherit ldflags; pname = "autocommitmsg"; version = lib.trim (builtins.readFile ./version.txt); src = ./.; @@ -17,4 +11,3 @@ pkgs.buildGoApplication { mainProgram = "autocommitmsg"; }; } -// attrs diff --git a/flake.nix b/flake.nix index 63e28be..e980664 100644 --- a/flake.nix +++ b/flake.nix @@ -32,18 +32,6 @@ in { default = pkgs.callPackage ./default.nix { }; - static-linux-amd64 = pkgs.callPackage ./default.nix { - CGO_ENABLED = 0; - GOOS = "linux"; - GOARCH = "amd64"; - ldflags = [ "-extldflags '-static'" ]; - }; - static-linux-arm64 = pkgs.callPackage ./default.nix { - CGO_ENABLED = 0; - GOOS = "linux"; - GOARCH = "arm64"; - ldflags = [ "-extldflags '-static'" ]; - }; } );