-
-
Notifications
You must be signed in to change notification settings - Fork 414
95 lines (81 loc) · 4.28 KB
/
release_dep.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
name: release_dep
on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
types:
- released
- prereleased
jobs:
build:
name: Build for ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.compiler }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ linux ]
compiler: [ gcc ]
arch: [ amd64 ]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Download dependencies
run: go mod download
- name: Generate builder values
id: values
run: |
echo "version=$(echo ${GITHUB_REF##*/} | sed -e 's/^[vV ]*//')" >> $GITHUB_OUTPUT
echo "timestamp=$(echo $(date +%FT%T%z))" >> $GITHUB_OUTPUT
echo "binary-name=rr" >> $GITHUB_OUTPUT
echo "sign-cert-name=rr.asc" >> $GITHUB_OUTPUT
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PASS }}
git_user_signingkey: true
git_commit_gpgsign: false
- name: Compile binary file
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CC: ${{ matrix.compiler }}
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASS: ${{secrets.GPG_PASS}}
CGO_ENABLED: 0
LDFLAGS: >-
-s
-X github.com/roadrunner-server/roadrunner/v2023/internal/meta.version=${{ steps.values.outputs.version }}
-X github.com/roadrunner-server/roadrunner/v2023/internal/meta.buildTime=${{ steps.values.outputs.timestamp }}
run: |
go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/rr
stat "./${{ steps.values.outputs.binary-name }}"
gpg --detach-sign --armor "./${{ steps.values.outputs.binary-name }}"
- name: Create DEB dirs
run: |
mkdir -p dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN
mkdir -p dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/usr/bin
ls -la dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64
- name: Create DEB control file
run: touch dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
- name: Build Debian package
run: |
echo "Package: roadrunner-${{ steps.values.outputs.version }}-linux-amd64.deb" >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
echo "Version: ${{ steps.values.outputs.version }}" >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
echo "Section: custom" >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
echo "Priority: optional" >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
echo "Architecture: amd64" >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
echo "Maintainer: roadrunner.dev" >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
echo "Description: High-performance PHP application server, load-balancer, process manager written in Go and powered with plugins." >> dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
cat dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/DEBIAN/control
cp "./${{ steps.values.outputs.binary-name }}" dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64/usr/bin/
dpkg --build dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64
- name: Upload dep to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/ubuntu/roadrunner-${{ steps.values.outputs.version }}-linux-amd64.deb
asset_name: roadrunner-${{ steps.values.outputs.version }}-linux-amd64.deb
tag: ${{ github.ref }}