Reconcile Gitea distribution with current alpha behavior and release tooling
Hop-State: A_06FN55REVAR7VQG4BWJBCD8 Hop-Proposal: R_06FN55QTEWKH16NSR59YJYG Hop-Task: T_06FN3MBF98GWD4NA5PA1RWG Hop-Attempt: AT_06FN55BQ80H2S8WHNDD24G0
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
code: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://gitea.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Set up Go
|
||||
uses: https://gitea.com/actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Test with race detection
|
||||
run: go test -race ./...
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
- name: Cross-compile supported targets
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for target in darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64 windows/arm64; do
|
||||
os=${target%/*}
|
||||
arch=${target#*/}
|
||||
output="dist-smoke/hop_${os}_${arch}"
|
||||
if [[ "$os" == windows ]]; then output="${output}.exe"; fi
|
||||
GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 go build -trimpath -o "$output" ./cmd/hop
|
||||
done
|
||||
- name: Validate POSIX installer syntax
|
||||
run: sh -n scripts/install.sh
|
||||
- name: Smoke-test POSIX installer
|
||||
run: sh scripts/test-install.sh
|
||||
|
||||
powershell-installer:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://gitea.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Set up Go
|
||||
uses: https://gitea.com/actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Validate PowerShell installer syntax
|
||||
shell: pwsh
|
||||
run: |
|
||||
$tokens = $null
|
||||
$errors = $null
|
||||
[void][System.Management.Automation.Language.Parser]::ParseFile(
|
||||
(Resolve-Path scripts/install.ps1), [ref]$tokens, [ref]$errors
|
||||
)
|
||||
if ($errors.Count -gt 0) {
|
||||
$errors | Format-List | Out-String | Write-Error
|
||||
exit 1
|
||||
}
|
||||
- name: Smoke-test PowerShell installer
|
||||
shell: pwsh
|
||||
run: ./scripts/test-install.ps1
|
||||
@@ -0,0 +1,59 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
code: read
|
||||
releases: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out full history
|
||||
uses: https://gitea.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: https://gitea.com/actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Require a public-release license
|
||||
run: test -f LICENSE
|
||||
- name: Test with race detection
|
||||
run: go test -race ./...
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
- name: Build and upload a draft Gitea Release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version=2.17.0
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64)
|
||||
arch=x86_64
|
||||
expected=dde10e2d5a13cef969c0eec00c74f359c0ac306d702b1bd291ad9337b4e54c1d
|
||||
;;
|
||||
aarch64|arm64)
|
||||
arch=arm64
|
||||
expected=75f93fc0e25d10d8535ffd0e4abcf39d6784a2467ba453d479ae513729a9ebbf
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported release runner architecture: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
archive="goreleaser_Linux_${arch}.tar.gz"
|
||||
tmp_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp_dir"' EXIT
|
||||
curl -fsSL --proto '=https' --tlsv1.2 \
|
||||
-o "$tmp_dir/$archive" \
|
||||
"https://github.com/goreleaser/goreleaser/releases/download/v${version}/${archive}"
|
||||
printf '%s %s\n' "$expected" "$tmp_dir/$archive" | sha256sum -c -
|
||||
tar -xzf "$tmp_dir/$archive" -C "$tmp_dir" goreleaser
|
||||
"$tmp_dir/goreleaser" release --clean
|
||||
Reference in New Issue
Block a user