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
112 changes: 112 additions & 0 deletions .github/workflows/docker-agentremote.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Publish AgentRemote Docker

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main

env:
GHCR_REGISTRY: ghcr.io
GHCR_REGISTRY_IMAGE: ghcr.io/${{ github.repository }}

jobs:
build-docker:
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- runs_on: ubuntu-latest
target: amd64
- runs_on: ubuntu-arm64
target: arm64
name: build-agentremote-docker (${{ matrix.target }})

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Prepare build metadata
id: meta
run: |
set -euo pipefail
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
version="${GITHUB_REF_NAME}"
else
version="${GITHUB_SHA}"
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "build_time=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to ghcr
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build agentremote image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/agentremote/Dockerfile
pull: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-${{ matrix.target }}
build-args: |
VERSION=${{ steps.meta.outputs.version }}
COMMIT=${{ github.sha }}
BUILD_TIME=${{ steps.meta.outputs.build_time }}
provenance: false
sbom: false

publish-manifests:
runs-on: ubuntu-latest
needs:
- build-docker
if: ${{ github.event_name != 'pull_request' }}

steps:
- name: Log in to ghcr
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create sha manifest
run: |
set -euo pipefail
docker pull ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-amd64
docker pull ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-arm64
docker manifest create ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }} \
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-amd64 \
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-arm64
docker manifest push ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}

- name: Create version manifest
if: ${{ github.ref_type == 'tag' }}
run: |
set -euo pipefail
docker manifest create ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.ref_name }} \
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-amd64 \
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-arm64
docker manifest push ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.ref_name }}

- name: Create latest manifest
if: ${{ github.ref == 'refs/heads/main' }}
run: |
set -euo pipefail
docker manifest create ${{ env.GHCR_REGISTRY_IMAGE }}:latest \
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-amd64 \
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-arm64
docker manifest push ${{ env.GHCR_REGISTRY_IMAGE }}:latest
23 changes: 23 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,26 @@ jobs:

- name: Run pre-commit
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

package-smoke:
runs-on: ubuntu-latest
name: Package Smoke

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25"
cache: true

- name: Build agentremote release binary
env:
CGO_ENABLED: "1"
run: go build -tags goolm -trimpath -o "$RUNNER_TEMP/agentremote" ./cmd/agentremote

- name: Validate install scripts
run: |
sh -n ./install.sh
sh -n ./tools/generate-homebrew-cask.sh
163 changes: 163 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: Publish Release

permissions:
contents: write

concurrency:
group: publish-release-${{ github.ref }}

on:
push:
tags:
- "v*"

env:
GOTOOLCHAIN: local

jobs:
build-binaries:
name: build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- runs_on: ubuntu-latest
goos: linux
goarch: amd64
- runs_on: ubuntu-arm64
goos: linux
goarch: arm64
- runs_on: macos-13
goos: darwin
goarch: amd64
- runs_on: macos-14
goos: darwin
goarch: arm64

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true

- name: Build release archive
env:
CGO_ENABLED: "1"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
VERSION: ${{ github.ref_name }}
COMMIT: ${{ github.sha }}
run: |
set -euo pipefail
version_no_v="${VERSION#v}"
archive_name="agentremote_v${version_no_v}_${GOOS}_${GOARCH}.tar.gz"
build_time="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
dist_dir="$RUNNER_TEMP/dist"
stage_dir="$RUNNER_TEMP/package"

mkdir -p "$dist_dir" "$stage_dir"

go build \
-tags goolm \
-trimpath \
-ldflags "-s -w -X main.Tag=${VERSION} -X main.Commit=${COMMIT} -X main.BuildTime=${build_time}" \
-o "$stage_dir/agentremote" \
./cmd/agentremote

cp LICENSE "$stage_dir/LICENSE"
cp README.md "$stage_dir/README.md"

tar -C "$stage_dir" -czf "$dist_dir/$archive_name" agentremote LICENSE README.md
shasum -a 256 "$dist_dir/$archive_name" | awk -v name="$archive_name" '{ print $1 " " name }' > "$dist_dir/$archive_name.sha256"

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
${{ runner.temp }}/dist/*.tar.gz
${{ runner.temp }}/dist/*.sha256
if-no-files-found: error

publish-release:
runs-on: ubuntu-latest
needs:
- build-binaries

steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: release-*
merge-multiple: true

- name: Assemble checksums
run: |
set -euo pipefail
cat dist/*.sha256 | sort -k2 > dist/checksums.txt
rm -f dist/*.sha256
ls -1 dist

- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/checksums.txt
generate_release_notes: true

update-homebrew-tap:
runs-on: ubuntu-latest
needs:
- publish-release
if: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN != '' }}

steps:
- name: Checkout source repo
uses: actions/checkout@v6

- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: release-*
merge-multiple: true

- name: Assemble checksums
run: |
set -euo pipefail
cat dist/*.sha256 | sort -k2 > dist/checksums.txt

- name: Checkout homebrew tap
uses: actions/checkout@v6
with:
repository: beeper/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
path: homebrew-tap

- name: Update agentremote cask
env:
VERSION: ${{ github.ref_name }}
run: |
set -euo pipefail
mkdir -p homebrew-tap/Casks
./tools/generate-homebrew-cask.sh "$VERSION" dist/checksums.txt > homebrew-tap/Casks/agentremote.rb

- name: Commit cask update
run: |
set -euo pipefail
cd homebrew-tap
if git diff --quiet -- Casks/agentremote.rb; then
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Casks/agentremote.rb
git commit -m "Update agentremote cask for ${{ github.ref_name }}"
git push
49 changes: 0 additions & 49 deletions .goreleaser.yml

This file was deleted.

Loading
Loading