-
Notifications
You must be signed in to change notification settings - Fork 267
123 lines (123 loc) · 3.63 KB
/
nightly-build.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Nightly Build
on:
workflow_dispatch:
inputs:
branch:
type: choice
description: 'choose build branch'
options:
- main
- dev
default: dev
platforms:
type: choice
description: 'build platforms'
options:
- linux
- windows
- darwin
default: linux
achitectures:
type: choice
description: 'build achitectures'
options:
- 386
- amd64
- arm-5
- arm-6
- arm-7
- arm64
- mips
- mipsle
- mips64
- mips64le
default: amd64
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
setup:
if: contains('["libsgh"]', github.actor)
name: build setup
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.setup.outputs.branch }}
target: ${{ steps.setup.outputs.target }}
steps:
- name: setup
id: setup
run: |
if ${{ github.event.inputs.platforms == ''}}; then
platforms="linux"
else
platforms="${{ github.event.inputs.platforms }}"
fi
if ${{ github.event.inputs.achitectures == ''}}; then
achitectures="amd64"
target='["linux/386", "linux/amd64", "linux/arm64", "linux/arm5", "linux/arm6", "linux/arm7", "windows/amd64", "window/386", "darwin-10.12/amd64", "darwin-10.12/arm64"]'
else
achitectures="${{ github.event.inputs.achitectures }}"
target='["'${platforms}'/'${achitectures}'"]'
fi
list=$(echo ${target} | jq -c)
echo "target=${list}" >> $GITHUB_OUTPUT
if ${{ github.event.inputs.branch == ''}}; then
branch='["dev"]'
else
branch='["${{ github.event.inputs.branch }}"]'
fi
b=$(echo ${branch} | jq -c)
echo "branch=${b}" >> $GITHUB_OUTPUT
build:
if: contains('["libsgh"]', github.actor)
needs: setup
strategy:
matrix:
target: ${{ fromJson(needs.setup.outputs.target) }}
branch: ${{ fromJson(needs.setup.outputs.branch) }}
go-version: [1.20.1]
name: build
runs-on: ubuntu-latest
outputs:
artifact_name: ${{ steps.artifact.outputs.name }}
steps:
- name: Setup Artifact Name
id: artifact
run: |
tar=${{ matrix.target }}
a=${tar//'/'/'-'}
echo "name=${a}" >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ matrix.branch }}
fetch-depth: 0
- name: Build
uses: px-org/build-action@main
with:
type: "nightly_build"
target: ${{ matrix.target }}
go-version: ${{ matrix.go-version }}
artifact-name: "PanIndex"
- name: upload
uses: actions/upload-artifact@v3
with:
name: PanIndex-${{ steps.artifact.outputs.name }}
path: ${{ github.workspace }}/dist/*
- name: Deploy to Dev Server
if: contains('linux-amd64', steps.artifact.outputs.name)
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DEV_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.DEV_HOST }}
REMOTE_USER: ${{ secrets.DEV_USERNAME }}
REMOTE_PORT: ${{ secrets.DEV_PORT }}
SOURCE: dist/
TARGET: ${{ secrets.DEV_TARGET }}
SCRIPT_AFTER: ${{ secrets.UPDATE_SCRIPT }}