-
Notifications
You must be signed in to change notification settings - Fork 8
83 lines (72 loc) · 2.3 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Create release
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.16]
os: [linux, darwin]
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: |
mkdir -p build
CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.arch }} go build -a -ldflags '-w -extldflags "-static"' -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o build/orchent-${{ matrix.arch }}-linux orchent.go
CGO_ENABLED=0 GOOS=darwin GOARCH=${{ matrix.arch }} go build -a -ldflags '-w -extldflags "-static"' -o build/orchent-${{ matrix.arch }}-darwin orchent.go
- name: Prepare packages
run: |
mkdir -p .debpkg/usr/bin
cp build/orchent-${{ matrix.arch }}-linux .debpkg/usr/bin/orchent
chmod +x .debpkg/usr/bin/orchent
mkdir -p .rpmpkg/usr/bin
cp build/orchent-${{ matrix.arch }}-linux .rpmpkg/usr/bin/orchent
chmod +x .rpmpkg/usr/bin/orchent
- name: Set rpm version
run: |
rpm_version="${{ github.ref/-/. }}"
echo $rpm_version
echo "REF=$rpm_version" >> $GITHUB_ENV
env:
github_ref: ${{ github.ref }}
- name: Create deb package
uses: jiro4989/build-deb-action@v2
with:
package: orchent
package_root: .debpkg
maintainer: Marica Antonacci <marica.antonacci@ba.infn.it>
version: ${{ github.ref }}
arch: ${{ matrix.arch }}
desc: 'orchent cli'
- name: Create rpm package
uses: jiro4989/build-rpm-action@v2
with:
summary: 'orchent cli'
package: orchent
package_root: .rpmpkg
maintainer: Marica Antonacci <marica.antonacci@ba.infn.it>
version: ${{ env.REF }}
arch: 'x86_64'
desc: 'orchent cli'
- name: debug
run: |
ls -latr
- name: Release
uses: softprops/action-gh-release@v1
#if: startsWith(github.ref, 'refs/tags/')
with:
body_path: CHANGELOG.md
draft: true
files: |
*.deb
*.rpm
build/orchent-${{ matrix.arch }}-darwin