-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (83 loc) · 2.43 KB
/
python-app.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
name: Linpad application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
attestations: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest test/
- name: Update executable in usr/bin
run: |
cp linpad.py usr/bin/linpad
chmod +x usr/bin/linpad
- name: List project files
run: |
ls -R
- name: Package Application
run: |
mkdir -p output
cp -r ./linpad.py ./output/
cp ./lin_logo.webp ./output/
cp -r ./DEBIAN ./output/
cp README.md ./output/
cp LICENSE ./output/
cp -r ./usr ./output/usr
- name: Create .deb Package
run: |
cd output
dpkg-deb --build . linpad.deb
- name: Upload .deb Package
uses: actions/upload-artifact@v3
with:
name: linpad-deb-package
path: output/linpad.deb
- name: Attest
uses: actions/attest-build-provenance@v1
id: attest
with:
subject-path: '${{ github.workspace }}/output'
- name: Tag the release version
id: tag_version
run: |
# Fetch the latest tag, if none found, start with v0.0.0
TAG=$(git tag -l | tail -n 1)
if [ -z "$TAG" ]; then
TAG="v0.0.0"
fi
# Extract the version numbers
VERSION=${TAG//v/}
# Split into an array
IFS='.' read -r -a VERSION_ARRAY <<< "$VERSION"
# Increment the last digit for beta versions
LAST=${VERSION_ARRAY[2]}
NEW_LAST=$((LAST + 1))
NEW_VERSION="v${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.$NEW_LAST-beta"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
git tag $NEW_VERSION
git push origin $NEW_VERSION