Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Binary
argus
bin/
dist/

# Git
.git
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Install toolchain from mise.toml
uses: jdx/mise-action@v4
with:
cache: true

- uses: actions/cache@v6
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Run CI pipeline
run: task ci
6 changes: 3 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -34,15 +34,15 @@ jobs:

- name: Get short SHA
id: sha
run: echo "short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
type=sha,prefix=
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Nightly

on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:

permissions:
contents: write
actions: write

jobs:
nightly:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Check for new commits
id: check
run: |
LATEST_NIGHTLY=$(git tag -l 'v*-nightly.*' --sort=-v:refname | head -1)
if [ -z "$LATEST_NIGHTLY" ]; then
echo "No previous nightly tag found, proceeding"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
COMMITS_SINCE=$(git rev-list "${LATEST_NIGHTLY}..HEAD" --count)
if [ "$COMMITS_SINCE" -gt 0 ]; then
echo "Found $COMMITS_SINCE new commits since $LATEST_NIGHTLY"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "No new commits since $LATEST_NIGHTLY, skipping"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
fi

- name: Compute next patch version
if: steps.check.outputs.has_changes == 'true'
id: version
run: |
# The manifest holds the last released version. A nightly must sort
# above it under semver, so tag the next patch: 0.15.0 -> v0.15.1-nightly.<date>.
RELEASED=$(jq -r '.["."]' .release-please-manifest.json)
IFS=. read -r MAJOR MINOR PATCH <<< "$RELEASED"
echo "version=${MAJOR}.${MINOR}.$((PATCH + 1))" >> "$GITHUB_OUTPUT"

- name: Create nightly tag
if: steps.check.outputs.has_changes == 'true'
run: |
DATE=$(date -u +%Y%m%d)
TAG="v${{ steps.version.outputs.version }}-nightly.${DATE}"
echo "Creating tag: $TAG"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Nightly build $DATE"
git push origin "$TAG"
gh workflow run prerelease.yml --ref "$TAG"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cleanup:
runs-on: ubuntu-latest
steps:
- name: Delete old nightly releases
uses: actions/github-script@v9
with:
script: |
const cutoff = new Date();
cutoff.setDate(cutoff.getDate() - 7);

const releases = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
});

for (const release of releases.data) {
if (!release.tag_name.includes('-nightly.')) continue;
if (new Date(release.created_at) >= cutoff) continue;

console.log(`Deleting old nightly release: ${release.tag_name}`);

await github.rest.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
});

try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${release.tag_name}`,
});
} catch (e) {
console.log(`Tag ${release.tag_name} already deleted or not found`);
}
}
19 changes: 14 additions & 5 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- 'v*-rc*'
- 'v*-beta*'
- 'v*-alpha*'
- 'v*-nightly*'
workflow_dispatch:

permissions:
contents: write
Expand All @@ -15,17 +17,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
- uses: jdx/mise-action@v4
with:
go-version-file: go.mod
cache: true

- uses: actions/cache@v6
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
- uses: googleapis/release-please-action@v5
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -28,18 +28,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ needs.release-please.outputs.tag_name }}

- name: Set up Go
uses: actions/setup-go@v5
- uses: jdx/mise-action@v4
with:
go-version-file: go.mod
cache: true

- uses: actions/cache@v6
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Compiled binary
argus
bin/
dist/
.task/

# Environment files (contain secrets)
.env
Expand Down
6 changes: 5 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ archives:
- tar.gz
name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
files:
- README.md
- LICENSE*

checksum:
name_template: 'checksums.txt'
Expand Down Expand Up @@ -58,11 +61,12 @@ changelog:
- '^chore'
- '^docs'
- '^test'
- '^ci'
- '^Merge'

release:
github:
owner: SentioLabs
owner: sentiolabs
name: argus
draft: false
prerelease: auto
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage - runs on native platform for fast cross-compilation
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.27-alpine AS builder

ARG TARGETARCH
ARG VERSION=dev
Expand Down
68 changes: 0 additions & 68 deletions Makefile

This file was deleted.

22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,32 @@ go install github.com/sentiolabs/argus@latest

### Build from source

Tool versions are pinned in `mise.toml`. Install [mise](https://mise.jdx.dev) once, then:

```bash
git clone https://github.com/sentiolabs/argus.git
cd argus
make build
mise install
task build
./bin/argus version
```

Run `task` with no arguments to list every task, including `test`, `lint`, and `ci`.

### Updating

A binary installed with the quick-install script or built from a release can update itself:

```bash
argus self update # install the newest release on your channel
argus self update --check # report whether an update is available, install nothing
argus self channel # show the current channel (stable by default)
argus self channel rc # follow release candidates
argus self channel nightly # follow nightly builds from main
```

The update downloads the release archive for your OS and architecture, verifies it against the release's `checksums.txt`, and replaces the running binary in place. Binaries managed by Homebrew, Nix, or a system package manager are refused with a hint to use that manager's upgrade command instead.

### Docker

```bash
Expand Down
Loading