Skip to content

Commit aba72ea

Browse files
committed
Merge pull request 'chore: add goreleaser to upload assets to gitea' (#182) from chore/enable-assets-upload-for-gitea into main
Reviewed-on: https://gitea.obmondo.com/EnableIT/Linuxaid-cli/pulls/182
2 parents 567339f + 1fcdaf6 commit aba72ea

5 files changed

Lines changed: 181 additions & 10 deletions

File tree

.gitea/workflows/release.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-22.04-htzhel1-ax42-a
14+
steps:
15+
- name: Checkout
16+
uses: https://gitea.obmondo.com/Obmondo/checkout@v4.3.0
17+
with:
18+
# This is required for the changelog to work correctly.
19+
fetch-depth: 0
20+
- name: Set up Go
21+
uses: https://gitea.obmondo.com/Obmondo/setup-go@v6.0.0
22+
with:
23+
go-version-file: go.mod
24+
cache-dependency-path: go.sum
25+
- name: Run GoReleaser
26+
uses: https://gitea.obmondo.com/Obmondo/goreleaser-action@v6.4.0
27+
with:
28+
version: "v2.12.7"
29+
args: release --clean -f .goreleaser-gitea.yaml
30+
env:
31+
GITEA_TOKEN: ${{ secrets.GORELEASER_TOKEN }}

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
uses: goreleaser/goreleaser-action@v6.4.0
2424
with:
2525
version: "v2.12.7"
26-
args: release --clean
26+
args: release --clean -f .goreleaser-github.yaml
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser-gitea.yaml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
version: 2
2+
3+
release:
4+
footer: >-
5+
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
6+
7+
changelog:
8+
use: gitea
9+
sort: asc
10+
format: "[{{ .SHA }}](https://gitea.obmondo.com/EnableIT/linuxaid-cli/commit/{{ .SHA }}) {{ .Message }}{{ with .AuthorUsername }} (@{{ . }}){{ end }}"
11+
abbrev: 7
12+
filters:
13+
exclude:
14+
- init
15+
- Merge pull request
16+
- Merge remote-tracking branch
17+
- Merge branch
18+
# Group commits messages by given regex and title.
19+
groups:
20+
- title: 💫 Features
21+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
22+
order: 0
23+
- title: 🐛 Bug fixes
24+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
25+
order: 1
26+
- title: 🥴 Others
27+
order: 999
28+
29+
archives:
30+
- formats: [tar.gz]
31+
# This name template makes the OS and Arch compatible with the results of uname.
32+
name_template: >-
33+
{{- .ProjectName }}_
34+
{{- .Tag }}_
35+
{{- .Os }}_
36+
{{- .Arch }}
37+
{{- if .Arm }}v{{ .Arm }}{{ end -}}
38+
builds_info:
39+
group: root
40+
owner: root
41+
mode: 0755
42+
mtime: "{{ .CommitDate }}"
43+
44+
before:
45+
hooks:
46+
- go mod tidy
47+
48+
builds:
49+
- id: "linuxaid-install"
50+
main: ./cmd/linuxaid-install
51+
binary: linuxaid-install
52+
env:
53+
- CGO_ENABLED=0
54+
goos:
55+
- linux
56+
goarch:
57+
- amd64
58+
- arm64
59+
- arm
60+
goarm:
61+
- "6"
62+
- "7"
63+
flags:
64+
- -v
65+
ldflags:
66+
- -X main.Version={{ .Tag }}
67+
- -s -w
68+
69+
- id: "linuxaid-cli"
70+
main: ./cmd/linuxaid-cli
71+
binary: linuxaid-cli
72+
env:
73+
- CGO_ENABLED=0
74+
goos:
75+
- linux
76+
goarch:
77+
- amd64
78+
- arm64
79+
- arm
80+
goarm:
81+
- "6"
82+
- "7"
83+
flags:
84+
- -v
85+
ldflags:
86+
- -X main.Version={{ .Tag }}
87+
- -s -w
88+
89+
nfpms:
90+
- id: linuxaid-cli-package
91+
package_name: linuxaid-cli
92+
ids:
93+
- linuxaid-cli
94+
file_name_template: >-
95+
{{- .PackageName }}_
96+
{{- .Tag }}_
97+
{{- .Os }}_
98+
{{- .Arch }}
99+
{{- if .Arm }}v{{ .Arm }}{{ end -}}
100+
{{- .ConventionalExtension }}
101+
vendor: Obmondo
102+
homepage: https://gitea.obmondo.com/EnableIT/linuxaid-cli
103+
maintainer: Obmondo <ops@obmondo.com>
104+
description: |-
105+
LinuxAid CLI tool.
106+
Command-line interface for LinuxAid.
107+
license: MIT
108+
formats:
109+
- deb
110+
- rpm
111+
- ipk
112+
bindir: /usr/bin
113+
mtime: "{{ .CommitDate }}"
114+
115+
- id: linuxaid-install-package
116+
package_name: linuxaid-install
117+
ids:
118+
- linuxaid-install
119+
file_name_template: >-
120+
{{- .PackageName }}_
121+
{{- .Tag }}_
122+
{{- .Os }}_
123+
{{- .Arch }}
124+
{{- if .Arm }}v{{ .Arm }}{{ end -}}
125+
{{- .ConventionalExtension }}
126+
vendor: Obmondo
127+
homepage: https://gitea.obmondo.com/EnableIT/linuxaid-cli
128+
maintainer: Obmondo <ops@obmondo.com>
129+
description: |-
130+
LinuxAid installer tool.
131+
Installation utility for Openvox via LinuxAid.
132+
license: MIT
133+
formats:
134+
- deb
135+
- rpm
136+
- ipk
137+
bindir: /usr/bin
138+
mtime: "{{ .CommitDate }}"
139+
140+
gitea_urls:
141+
api: https://gitea.obmondo.com/api/v1
142+
download: https://gitea.obmondo.com
143+
skip_tls_verify: false

install.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
PROJECT="linuxaid-cli"
5+
REPO="Obmondo/$PROJECT"
6+
API_URL="https://api.github.com/repos/$REPO/releases/latest"
7+
BIN_DIR="/usr/local/bin"
8+
BIN_NAME="linuxaid-install"
9+
410
function cleanup() {
511
rm -rf "$TMP_DIR"
612
exit 130
@@ -23,11 +29,6 @@ esac
2329
# -------------------------------------------------
2430
# 2. Find latest release tag on GitHub
2531
# -------------------------------------------------
26-
PROJECT=linuxaid-cli""
27-
REPO="Obmondo/$PROJECT"
28-
API_URL="https://api.github.com/repos/$REPO/releases/latest"
29-
30-
# Grab the tag name (e.g., v1.2.3)
3132
TAG=$(curl -sSf "$API_URL" | jq -r '.tag_name')
3233
if [[ -z "$TAG" ]]; then
3334
echo "Failed to obtain latest release tag" >&2
@@ -37,17 +38,13 @@ fi
3738
# -------------------------------------------------
3839
# 3. Build download URL for the appropriate asset
3940
# -------------------------------------------------
40-
# Expected asset name pattern: $PROJECT_${TAG}_linux_${TARGET}.tar.gz
4141
ASSET="${PROJECT}_${TAG}_linux_${TARGET}.tar.gz"
4242
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$TAG/$ASSET"
4343
SOURCE_CHECKSUM=$(curl -sSf "https://api.github.com/repos/$REPO/releases/latest" | jq -r --arg url "$DOWNLOAD_URL" '.assets[] | select(.browser_download_url == $url) | .digest | split(":")[1]')
4444

4545
# -------------------------------------------------
4646
# 4. Download the package from Github
4747
# -------------------------------------------------
48-
BIN_DIR="/usr/local/bin"
49-
BIN_NAME="linuxaid-install"
50-
5148
# Trap SIGTERM (15), SIGINT (2 - Ctrl+C), and SIGHUP (1)
5249
trap cleanup SIGTERM SIGINT SIGHUP EXIT
5350

0 commit comments

Comments
 (0)