diff --git a/.github/workflows/main.yml b/.github/workflows/build.yml similarity index 87% rename from .github/workflows/main.yml rename to .github/workflows/build.yml index 42ea09a..d46fbee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Main +name: Build on: push @@ -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 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" 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.