-
Notifications
You must be signed in to change notification settings - Fork 5
156 lines (130 loc) · 3.87 KB
/
release.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Release
run-name: Release ${{ github.event.inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: Version to be released
required: true
commit:
description: Commit to be released
required: false
defaults:
run:
shell: bash
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
VERSION: "${{ github.event.inputs.version }}"
COMMIT: "${{ github.event.inputs.commit }}"
jobs:
test:
name: Tests
environment: staging
runs-on: ubuntu-latest
steps:
- name: Print Input
run: |
echo "VERSION"
echo "${{ env.VERSION }}"
echo "COMMIT"
echo "${{ env.COMMIT }}"
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.COMMIT }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Setup Project
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r requirements.txt
- name: Lint
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test
run: |
./run_tests.sh
build-ubuntu:
name: Ubuntu Release
environment: staging
runs-on: ubuntu-latest
needs: test
env:
PACKAGE_NAME: "logsmith_linux_${VERSION}.zip"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.COMMIT }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Setup Project
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Project
run: |
python -m PyInstaller ./logsmith.spec
zip -r "${{ env.PACKAGE_NAME }}" ./dist/logsmith
- name: Release
run: |
if [ "${{ env.COMMIT }}" != "" ]; then
commit=${{ env.COMMIT }}
else
commit=${GITHUB_SHA}
fi
pip install requests
./ci/release.py \
--repository "${{ github.repository }}" \
--version "${{ env.VERSION }}" \
--commit "${commit}" \
--token "${{ secrets.GITHUB_TOKEN }}" \
--asset "${{ env.PACKAGE_NAME }}"
build-darwin:
name: Darwin Release
environment: staging
runs-on: macos-latest
needs: test
env:
PACKAGE_NAME: "logsmith_darwin_${VERSION}.zip"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.COMMIT }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Setup Project
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Project
run: |
python -m PyInstaller ./logsmith.spec
zip -r "${{ env.PACKAGE_NAME }}" ./dist/logsmith.app
- name: Release
run: |
if [ "${{ env.COMMIT }}" != "" ]; then
commit=${{ env.COMMIT }}
else
commit=${GITHUB_SHA}
fi
pip install requests
./ci/release.py \
--repository "${{ github.repository }}" \
--version "${{ env.VERSION }}" \
--commit "${commit}" \
--token "${{ secrets.GITHUB_TOKEN }}" \
--asset "${{ env.PACKAGE_NAME }}"