Skip to content

Commit 2fa8acb

Browse files
committed
Improve package creation workflow
- Create sdist artifact - Upload dist to release - Reuse for other jobs - Build DEB package directly using GH actions
1 parent fb37c0a commit 2fa8acb

File tree

1 file changed

+63
-9
lines changed

1 file changed

+63
-9
lines changed

.github/workflows/packaging.yml

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,37 @@ jobs:
3030
- name: Test with tox
3131
run: tox
3232

33+
build-sdist:
34+
runs-on: ubuntu-latest
35+
needs:
36+
- test
37+
steps:
38+
- name: Get cASO repo
39+
uses: actions/checkout@v3
40+
with:
41+
ref: ${{ github.ref_name }}
42+
- name: Build sdist file
43+
run: python setup.py sdist
44+
45+
- name: Upload sidst to be used for other jobs
46+
uses: actions/upload-artifact@v3
47+
with:
48+
path: dist/caso-${{ github.ref_name }}.tar.gz
49+
name: caso-${{ github.ref_name }}.tar.gz
50+
51+
- name: Update source distribution artifacts to release
52+
if: github.event_name == 'release'
53+
uses: AButler/[email protected]
54+
with:
55+
files: 'dist/*tar.gz'
56+
repo-token: ${{ secrets.GITHUB_TOKEN }}
57+
release-tag: ${{ github.ref_name }}
58+
3359
build-deb:
3460
runs-on: ubuntu-latest
35-
needs: test
61+
needs:
62+
- test
63+
- build-sdist
3664
steps:
3765
- name: Get cASO repo
3866
uses: actions/checkout@v3
@@ -42,33 +70,59 @@ jobs:
4270
- name: Copy debian file into the correct place for the build
4371
run: cp -r packaging/debian debian
4472

45-
- name: Build Debian package
46-
uses: alvarolopez/action-debian-python-package@v4
73+
- name: Install Debian deps
74+
run: sudo apt-get install -y dpkg-dev debhelper devscripts lintian python3-pip tox dh-python python3-all python3-all-dev python3-pbr
75+
76+
- name: Install dependencies
77+
run: pip install -r requirements.txt
78+
79+
- name: Download sdist artifact
80+
uses: actions/download-artifact@v3
4781
with:
48-
artifacts_directory: output
49-
os_distribution: stable
82+
name: caso-${{ github.ref_name }}.tar.gz
83+
path: dist
84+
85+
- name: Copy sdist to expected debian source file
86+
run: cp dist/caso-${{ github.ref_name }}.tar.gz ../caso-${{ github.ref_name }}.orig.tar.gz
87+
88+
- name: Now build package
89+
run: dpkg-buildpackage -b
90+
91+
- name: debug
92+
run: ls
93+
94+
- name: debug
95+
run: ls ..
5096

5197
- name: Update DEB artifacts to release
5298
if: github.event_name == 'release'
5399
uses: AButler/[email protected]
54100
with:
55-
files: 'output/*deb'
101+
files: '../*deb'
56102
repo-token: ${{ secrets.GITHUB_TOKEN }}
57103
release-tag: ${{ github.ref_name }}
58104

59105
build-rpm:
60106
runs-on: ubuntu-latest
61-
needs: test
107+
needs:
108+
- build-sdist
109+
- test
62110
steps:
63111
- name: Get cASO repo
64112
uses: actions/checkout@v3
65113
with:
66114
repository: IFCA/caso
67115
ref: ${{ github.ref_name }}
68116

69-
- name: Build sdist to use as source
70-
run: python setup.py sdist
117+
- name: Download sdist artifact
118+
uses: actions/download-artifact@v3
119+
with:
120+
name: caso-${{ github.ref_name }}.tar.gz
121+
path: dist
71122

123+
- name: debug
124+
run: ls
125+
72126
- name: Build RPM package
73127
id: rpm
74128
uses: alvarolopez/rpmbuild@rockylinux9

0 commit comments

Comments
 (0)