-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (88 loc) · 3.04 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
99
100
101
102
103
name: Python Application Test
on:
push:
branches:
- master
#tags:
#- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y apt-rdepends
- name: Run test without root rights
id: run-without-root-rights
run: |
python3 apt-who-needs.py;
- name: Run test without package
id: run-without-package
run: |
sudo python3 apt-who-needs.py;
- name: Run test with package
id: run-with-package
run: |
sudo python3 apt-who-needs.py apt;
build:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev
- name: Get the latest tag
id: get-latest-tag
run: |
echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV
- name: Build .deb Package
run: |
mkdir -p apt-who-needs/DEBIAN
mkdir -p apt-who-needs/usr/local/bin
echo "Package: apt-who-needs" > apt-who-needs/DEBIAN/control
echo "Version: ${{ env.LATEST_TAG }}" >> apt-who-needs/DEBIAN/control
echo "Section: base" >> apt-who-needs/DEBIAN/control
echo "Priority: optional" >> apt-who-needs/DEBIAN/control
echo "Architecture: all" >> apt-who-needs/DEBIAN/control
echo "Depends: apt, apt-rdepends, python3" >> apt-who-needs/DEBIAN/control
echo "Maintainer: ${{ secrets.MY_NAME }} <${{ secrets.MY_EMAIL }}>" >> apt-who-needs/DEBIAN/control
echo "Description: Efinds out which packages depend on the specified package " >> apt-who-needs/DEBIAN/control
cp apt-who-needs.py apt-who-needs/usr/local/bin/apt-who-needs
chmod +x apt-who-needs/usr/local/bin/apt-who-needs
dpkg-deb --build apt-who-needs
- name: Upload .deb Package as Artifact
uses: actions/upload-artifact@v4
with:
name: apt-who-needs
path: apt-who-needs.deb
- name: Create Release
id: create_release
#if: steps.check_tag.outputs.tag_exists == 'false'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.MAGIC_TOKEN }}
with:
tag_name: ${{ env.LATEST_TAG }}
release_name: Release ${{ env.LATEST_TAG }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.MAGIC_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./apt-who-needs.deb
asset_name: apt-who-needs.deb
asset_content_type: application/octet-stream