Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Test
Expand Down
146 changes: 143 additions & 3 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Import Apple certificate
Expand All @@ -38,7 +38,7 @@ jobs:
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v7
with:
version: "~> v2"
args: release --clean
Expand All @@ -61,3 +61,143 @@ jobs:
--team-id "$APPLE_TEAM_ID" \
--wait
done

apt:
name: Publish apt repository
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: read
steps:
- name: Install dpkg-dev
run: sudo apt-get install -y dpkg-dev

- name: Checkout apt repo
uses: actions/checkout@v6
with:
repository: apialerts/apt
token: ${{ secrets.GORELEASER_TOKEN }}
path: apt-repo

- name: Download .deb packages from release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ github.event.release.tag_name }} \
--pattern "*.deb" \
--dir debs \
--repo ${{ github.repository }}

- name: Import GPG key
run: echo "${{ secrets.APT_GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import

- name: Update apt repository
env:
APT_GPG_PASSPHRASE: ${{ secrets.APT_GPG_PASSPHRASE }}
run: |
mkdir -p apt-repo/pool/main/a/apialerts
cp debs/*.deb apt-repo/pool/main/a/apialerts/

cd apt-repo
mkdir -p dists/stable/main/binary-amd64
mkdir -p dists/stable/main/binary-arm64

dpkg-scanpackages --arch amd64 pool/ > dists/stable/main/binary-amd64/Packages
gzip -kf dists/stable/main/binary-amd64/Packages

dpkg-scanpackages --arch arm64 pool/ > dists/stable/main/binary-arm64/Packages
gzip -kf dists/stable/main/binary-arm64/Packages

gpg --armor --export > key.gpg

{
echo "Origin: apialerts"
echo "Label: apialerts"
echo "Suite: stable"
echo "Codename: stable"
echo "Architectures: amd64 arm64"
echo "Components: main"
echo "Description: API Alerts apt repository"
echo "Date: $(date -Ru)"
echo "MD5Sum:"
for f in dists/stable/main/binary-*/Packages*; do
printf " %s %s %s\n" "$(md5sum "$f" | cut -d' ' -f1)" "$(wc -c < "$f")" "${f#dists/stable/}"
done
echo "SHA256:"
for f in dists/stable/main/binary-*/Packages*; do
printf " %s %s %s\n" "$(sha256sum "$f" | cut -d' ' -f1)" "$(wc -c < "$f")" "${f#dists/stable/}"
done
} > dists/stable/Release

gpg --batch --yes --pinentry-mode loopback --passphrase "$APT_GPG_PASSPHRASE" \
--clearsign -o dists/stable/InRelease dists/stable/Release
gpg --batch --yes --pinentry-mode loopback --passphrase "$APT_GPG_PASSPHRASE" \
-abs -o dists/stable/Release.gpg dists/stable/Release

- name: Push apt repo
run: |
cd apt-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff --staged --quiet || git commit -m "Release ${{ github.event.release.tag_name }}"
git push

rpm:
name: Publish rpm repository
runs-on: ubuntu-latest
needs: goreleaser
permissions:
contents: read
steps:
- name: Install createrepo
run: sudo apt-get install -y createrepo-c rpm

- name: Checkout rpm repo
uses: actions/checkout@v6
with:
repository: apialerts/rpm
token: ${{ secrets.GORELEASER_TOKEN }}
path: rpm-repo

- name: Download .rpm packages from release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ github.event.release.tag_name }} \
--pattern "*.rpm" \
--dir rpms \
--repo ${{ github.repository }}

- name: Import GPG key
run: echo "${{ secrets.APT_GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import

- name: Update rpm repository
env:
APT_GPG_PASSPHRASE: ${{ secrets.APT_GPG_PASSPHRASE }}
run: |
mkdir -p rpm-repo/packages
cp rpms/*.rpm rpm-repo/packages/

gpg --armor --export > rpm-repo/key.gpg

echo "$APT_GPG_PASSPHRASE" > /tmp/gpg-passphrase
printf '%%_signature gpg\n%%_gpg_name API Alerts <support@apialerts.com>\n%%__gpg_sign_cmd %%{__gpg} gpg --batch --no-verbose --no-armor --pinentry-mode loopback --passphrase-file /tmp/gpg-passphrase --no-secmem-warning -u "%%{_gpg_name}" -sbo %%{__signature_filename} %%{__plaintext_filename}\n' > ~/.rpmmacros
for rpm_file in rpm-repo/packages/*.rpm; do
rpmsign --addsign "$rpm_file"
done
rm /tmp/gpg-passphrase

createrepo_c rpm-repo/

gpg --batch --yes --pinentry-mode loopback --passphrase "$APT_GPG_PASSPHRASE" \
--detach-sign --armor rpm-repo/repodata/repomd.xml

- name: Push rpm repo
run: |
cd rpm-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff --staged --quiet || git commit -m "Release ${{ github.event.release.tag_name }}"
git push
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Test
Expand Down
12 changes: 12 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ archives:
checksum:
name_template: "checksums.txt"

nfpms:
- id: packages
package_name: apialerts
vendor: apialerts
homepage: https://apialerts.com
maintainer: API Alerts <support@apialerts.com>
description: API Alerts CLI — send events from your terminal
license: MIT
formats:
- deb
- rpm

homebrew_casks:
- name: apialerts
repository:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 apialerts
Copyright (c) 2026 apialerts

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ brew tap apialerts/tap
brew install --cask apialerts
```

### apt (Debian / Ubuntu and derivatives)

```bash
curl -fsSL https://apt.apialerts.com/key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/apialerts.gpg
echo "deb [signed-by=/usr/share/keyrings/apialerts.gpg] https://apt.apialerts.com stable main" | sudo tee /etc/apt/sources.list.d/apialerts.list
sudo apt update && sudo apt install apialerts
```

### dnf (Fedora / RHEL / CentOS)

```bash
sudo rpm --import https://rpm.apialerts.com/key.gpg
sudo tee /etc/yum.repos.d/apialerts.repo <<EOF
[apialerts]
name=API Alerts
baseurl=https://rpm.apialerts.com
enabled=1
gpgcheck=1
gpgkey=https://rpm.apialerts.com/key.gpg
EOF
sudo dnf install apialerts
```

### Scoop (Windows)

```bash
Expand Down
2 changes: 1 addition & 1 deletion cmd/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package cmd

const (
IntegrationName = "apialerts-cli"
Version = "1.2.1"
Version = "1.3.0"
)
2 changes: 1 addition & 1 deletion cmd/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Properties:

result, err := apialerts.SendAsync(event)
if err != nil {
return fmt.Errorf("failed to send: %w", err)
return fmt.Errorf("failed to send: %s", err)
}

fmt.Printf("✓ Alert sent to %s (%s)\n", result.Workspace, result.Channel)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/apialerts/cli
go 1.25.0

require (
github.com/apialerts/apialerts-go v1.2.0-alpha.5
github.com/apialerts/apialerts-go v1.2.0-alpha.6
github.com/spf13/cobra v1.10.2
golang.org/x/term v0.41.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/apialerts/apialerts-go v1.2.0-alpha.5 h1:NO8XBAJoBOGYq7Di6ld8cQPBZ62NKjnlayvosC6TIJ4=
github.com/apialerts/apialerts-go v1.2.0-alpha.5/go.mod h1:HhLAxT5uQOZUZLXYPSrQJduUYj+yzB6yU3/KjcDT9hU=
github.com/apialerts/apialerts-go v1.2.0-alpha.6 h1:WxBTfc9Dc50wAmaOlg0Mme9M7JY0iJJXb0sw3hPzBnY=
github.com/apialerts/apialerts-go v1.2.0-alpha.6/go.mod h1:HhLAxT5uQOZUZLXYPSrQJduUYj+yzB6yU3/KjcDT9hU=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
Expand Down