Skip to content

Commit 2e06db4

Browse files
committed
feat: add release workflow and install script
- GitHub Actions workflow builds static binary on tag push - Simple curl-based install script for non-Nix users - Fix .gitignore to not match cmd/devproxy directory
1 parent 0a97f1c commit 2e06db4

3 files changed

Lines changed: 49 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Build
21+
run: CGO_ENABLED=0 go build -ldflags="-s -w" -o devproxy ./cmd/devproxy
22+
23+
- name: Create release
24+
env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
TAG: ${{ github.ref_name }}
27+
run: gh release create "$TAG" devproxy --title "$TAG" --generate-notes

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
devproxy
2-
result
1+
/devproxy
2+
/result

install.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
set -e
3+
4+
REPO="alysnnix/devproxy"
5+
INSTALL_DIR="/usr/local/bin"
6+
7+
TAG=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)
8+
9+
if [ -z "$TAG" ]; then
10+
echo "error: could not determine latest release" >&2
11+
exit 1
12+
fi
13+
14+
echo "Installing devproxy ${TAG}..."
15+
16+
curl -fsSL "https://github.com/${REPO}/releases/download/${TAG}/devproxy" -o /tmp/devproxy
17+
install -m 755 /tmp/devproxy "${INSTALL_DIR}/devproxy"
18+
rm -f /tmp/devproxy
19+
20+
echo "devproxy ${TAG} installed to ${INSTALL_DIR}/devproxy"

0 commit comments

Comments
 (0)