File tree 5 files changed +144
-0
lines changed
5 files changed +144
-0
lines changed Original file line number Diff line number Diff line change 29
29
args : release --rm-dist
30
30
env :
31
31
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
32
+ package-deb :
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - name : Checkout
36
+ uses : actions/checkout@v2
37
+ with :
38
+ fetch-depth : 0
39
+ - name : Set up Go
40
+ uses : actions/setup-go@v2
41
+ with :
42
+ go-version : 1.17
43
+ - name : Add packaging config to goreleaser config
44
+ run : cat .goreleaser.pkg.yml >> .goreleaser.yml
45
+ - name : create gpg key
46
+ run : echo "${GPG_KEY}" > /root/gpg
47
+ env :
48
+ GPG_KEY : ${{ secrets.GPG_KEY }}
49
+ - name : Build and package deb
50
+ run : ./goreleaser release --skip-validate --rm-dist --skip-publish
51
+ # - name: Build and package deb
52
+ # uses: goreleaser/goreleaser-action@v2
53
+ # with:
54
+ # version: latest
55
+ # args: release --skip-validate --rm-dist --skip-publish
56
+ env :
57
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58
+ GPG_KEY : ' /root/gpg'
59
+ package-rpm :
60
+ runs-on : ubuntu-latest
61
+ container : fedora:latest
62
+ needs : [goreleaser]
63
+ steps :
64
+ - name : Get tag
65
+ id : get_tag
66
+ run : echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
67
+ - name : Get version
68
+ id : get_version
69
+ run : echo ::set-output name=VERSION::${TAG##v}
70
+ env :
71
+ TAG : ${{ steps.get_tag.outputs.TAG }}
72
+ - name : Install make
73
+ run : dnf install make -y
74
+ - name : Setup rpm-build
75
+ run : make rpm-setup
76
+ - name : Build srpm
77
+ run : make srpm-build
78
+ env :
79
+ VERSION : ${{ steps.get_version.outputs.VERSION }}
80
+ - name : Publish rpm
81
+ run : |
82
+ mkdir -p ~/.config
83
+ echo "${SCW_COPR_CONFIG}" > ~/.config/copr
84
+ copr-cli build @scaleway/staging ~/rpmbuild/SRPMS/scw-*.rpm
85
+ env :
86
+ SCW_COPR_CONFIG : ${{ secrets.SCW_COPR_CONFIG }}
Original file line number Diff line number Diff line change
1
+ nfpms :
2
+ -
3
+ package_name : scw
4
+ vendor : Scaleway
5
+ homepage : https://www.scaleway.com/
6
+ description : Scaleway CLI is a tool to help you pilot your Scaleway infrastructure directly from your terminal.
7
+ maintainer :
Scaleway Devtools <[email protected] >
8
+ license : Apache 2.0
9
+ formats :
10
+ - deb
11
+ deb :
12
+ signature :
13
+ key_file : ' {{ .Env.GPG_KEY }}'
14
+ key_id : F5BF26CADF6F9614
15
+ type : origin
16
+
Original file line number Diff line number Diff line change 80
80
- glob : scw-cli-v2-version
81
81
ids :
82
82
- binaries
83
+
Original file line number Diff line number Diff line change
1
+ SHELL =bash
2
+
3
+ rpm-setup :
4
+ sudo dnf groupinstall " RPM Development Tools" -y
5
+ sudo dnf install copr-cli -y
6
+ rpmdev-setuptree
7
+ sudo dnf install jq -y
8
+
9
+ template-rpm-spec : require-version
10
+ sed s/\%\{ version_\} /${VERSION} /g specs/rpm/scaleway-cli.tmpl.spec > specs/rpm/scaleway-cli.spec
11
+ RELEASE_JSON=" $$ (curl https://api.github.com/repos/scaleway/scaleway-cli/releases/tags/v${VERSION} )" ; \
12
+ DATE=$$(date -d "$$(echo $${RELEASE_JSON} | jq ."created_at" -r ) " "+%a %b %d %Y" ) ; \
13
+ CHANGELOG=" $$ (echo $$ {RELEASE_JSON} | jq ." body" -r | grep '^*' | sed s/^\*/-/g)" ; \
14
+ echo " * $$ {DATE} Scaleway Devtools <[email protected] > - ${VERSION} " >> specs/rpm/scaleway-cli.spec
; \
15
+ echo " $$ {CHANGELOG}" >> specs/rpm/scaleway-cli.spec
16
+
17
+ srpm-build : require-version template-rpm-spec
18
+ sudo dnf builddep specs/rpm/scaleway-cli.spec -y
19
+ spectool -g -R specs/rpm/scaleway-cli.spec --define " version_ ${VERSION} "
20
+ rpmbuild -ba specs/rpm/scaleway-cli.spec --define " version_ ${VERSION} "
21
+
22
+ rpm-build : srpm-build
23
+ cd ~ /rpmbuild/
24
+ rpmbuild -bs
25
+
26
+ require-version :
27
+ ifndef VERSION
28
+ $(error VERSION is undefined)
29
+ endif
30
+
31
+ .PHONY : rpm-setup rpm-build srpm-build
Original file line number Diff line number Diff line change
1
+ Name: scw
2
+ Version: %{version_ }
3
+ Release: 1%{?dist }
4
+ Summary: Scaleway CLI
5
+
6
+ License: Apache License 2.0
7
+ URL: https://github.com/scaleway/scaleway-cli
8
+ Source0: https://github.com/scaleway/scaleway-cli/archive/refs/tags/v%{version }.tar.gz
9
+
10
+ %if 0%{?suse_version }
11
+ BuildRequires: go git
12
+ %else
13
+ BuildRequires: golang git
14
+ %endif
15
+
16
+ Provides: %{name } = %{version }
17
+
18
+ %description
19
+ Scaleway CLI
20
+
21
+ %global debug_package %{nil }
22
+
23
+ %prep
24
+ %autosetup -n scaleway-cli-%{version }
25
+
26
+
27
+ %build
28
+ export CGO_ENABLED=0
29
+ LDFLAGS=" -w -extldflags -static -X main.Version=%{version}"
30
+ GOPROXY=direct GOOS=linux GOARCH=amd64 go build -ldflags " ${LDFLAGS} " -o %{name } cmd/scw/main.go
31
+
32
+
33
+ %install
34
+ install -Dpm 0755 %{name } %{buildroot }%{_bindir }/%{name }
35
+
36
+
37
+ %files
38
+ %{_bindir }/%{name }
39
+
40
+
41
+ %changelog
You can’t perform that action at this time.
0 commit comments