-
-
Notifications
You must be signed in to change notification settings - Fork 161
118 lines (113 loc) · 3.4 KB
/
release-rpm.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: "Release RPM"
on:
# release:
# type:
# - created
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true
arch:
type: choice
description: 'Architecture to build'
required: true
default: all
options:
- all
- x86_64
- arm64
gh-release:
type: boolean
description: 'Update GitHub release'
required: true
default: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check tag exists
uses: mukunku/[email protected]
id: check-tag
with:
tag: ${{ github.event.inputs.tag }}
- name: Exit if tag does not exist
run: |
if [[ "${{ steps.check-tag.outputs.exists }}" == "false" ]]; then
echo "Tag ${{ github.event.inputs.tag }} does not exist"
exit 1
fi
# Include arm64 if ref is a tag
setup-matrix:
needs:
- check
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up matrix
id: set-matrix
run: |
if [[ "${{ github.event.inputs.arch }}" == "all" ]]; then
echo "matrix=[\"ubuntu-latest\", \"arm64\"]" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.inputs.arch }}" == "x86_64" ]]; then
echo "matrix=[\"ubuntu-latest\"]" >> $GITHUB_OUTPUT
else
echo "matrix=[\"arm64\"]" >> $GITHUB_OUTPUT
fi
build:
needs:
- setup-matrix
strategy:
matrix:
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ${{ matrix.os }}
steps:
- name: Prepare workspace
run: rm -rf build-rpm && mkdir build-rpm
- name: Download ${{ github.event.inputs.tag }} source code
uses: robinraju/[email protected]
with:
token: ${{ secrets.GH_PAT }}
tag: ${{ github.event.inputs.tag }}
fileName: globalprotect-openconnect-*.tar.gz
tarBall: false
zipBall: false
out-file-path: build-rpm
- name: Docker Login
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
- name: Build RPM package in Docker
run: |
docker run --rm -v $(pwd)/build-rpm:/rpm -e INCLUDE_GUI=1 yuezk/gpdev:rpm-builder
- name: Install RPM package in Docker
run: |
docker run --rm -v $(pwd)/build-rpm:/rpm yuezk/gpdev:rpm-builder \
bash -c "sudo rpm -i /rpm/*.$(uname -m).rpm; gpclient -V; gpservice -V; gpauth -V; gpgui-helper -V; gpgui -V;"
- name: Upload RPM package
uses: actions/upload-artifact@v3
with:
name: artifact-rpm-${{ matrix.os }}
if-no-files-found: error
path: |
build-rpm/*.rpm
gh-release:
needs:
- build
runs-on: ubuntu-latest
if: ${{ github.event.inputs.gh-release == 'true' }}
steps:
- name: Prepare workspace
run: rm -rf gh-release && mkdir gh-release
- name: Download RPM package
uses: actions/download-artifact@v3
with:
path: gh-release
- name: Update release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GH_PAT }}
prerelease: ${{ contains(github.ref, 'latest') }}
fail_on_unmatched_files: true
tag_name: ${{ github.event.inputs.tag }}
files: |
gh-release/artifact-*/*