-
-
Notifications
You must be signed in to change notification settings - Fork 12
125 lines (113 loc) · 4.39 KB
/
release-debian.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
name: Release Debian
on:
workflow_dispatch:
env:
PACKAGE: qucsrflayout
OBS_USER: thomaslepoix
OBS_PROJECT: home:${OBS_USER}:open-rflab
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Dependencies
run: |
sudo apt update
sudo apt install -y dpkg-dev
- name: Checkout
uses: actions/checkout@v4
with:
ref: debian
- name: Extract tag
id: extract
shell: bash
run: |
echo "version=$( \
head debian/changelog -n 1 \
| awk '{print $2}' \
| sed -e 's/(//g' -e 's/)//g' \
| awk -F - '{print $1}' \
)" >> $GITHUB_OUTPUT
echo "revision=$( \
head debian/changelog -n 1 \
| awk '{print $2}' \
| sed -e 's/(//g' -e 's/)//g' \
| awk -F - '{print $2}' \
)" >> $GITHUB_OUTPUT
- name: Download & fix origin tarball
run: |
REPO=$(echo ${GITHUB_REPOSITORY} | sed "s/${GITHUB_ACTOR}\///g")
wget \
${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/archive/refs/tags/${{ steps.extract.outputs.version }}.tar.gz \
-O ${REPO}_${{ steps.extract.outputs.version }}.orig.tar.gz
tar -xzvf ${REPO}_${{ steps.extract.outputs.version }}.orig.tar.gz
mv \
${REPO}-${{ steps.extract.outputs.version }} \
${{ env.PACKAGE }}-${{ steps.extract.outputs.version }}
tar -czvf \
${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}.orig.tar.gz \
${{ env.PACKAGE }}-${{ steps.extract.outputs.version }}
rm ${REPO}_${{ steps.extract.outputs.version }}.orig.tar.gz
- name: Untar & debianize
run: |
tar -xzvf ${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}.orig.tar.gz
mv debian ${{ env.PACKAGE }}-${{ steps.extract.outputs.version }}
- name: Package
run: dpkg-source -b ${{ env.PACKAGE }}-${{ steps.extract.outputs.version }}
- name: Remove old source package on OBS
run: |
INFOS="$( \
curl \
--user ${{ env.OBS_USER }}:${{ secrets.OBS_PASSWORD }} \
https://api.opensuse.org/source/${{ env.OBS_PROJECT }}/${{ env.PACKAGE }}/)"
OLD_DSC="$( \
echo "${INFOS}" \
| grep .dsc \
| awk '{print $2}' \
| sed -e 's/name="//g' -e 's/"$//g' \
)"
OLD_DEBIAN_TXZ="$( \
echo "${INFOS}" \
| grep .debian.tar.xz \
| awk '{print $2}' \
| sed -e 's/name="//g' -e 's/"$//g' \
)"
OLD_ORIG_TGZ="$( \
echo "${INFOS}" \
| grep .orig.tar.gz \
| awk '{print $2}' \
| sed -e 's/name="//g' -e 's/"$//g' \
)"
if [ "${OLD_DSC}" ]
then curl \
--user ${{ env.OBS_USER }}:${{ secrets.OBS_PASSWORD }} \
-X DELETE https://api.opensuse.org/source/${{ env.OBS_PROJECT }}/${{ env.PACKAGE }}/${OLD_DSC}
fi
if [ "${OLD_DEBIAN_TXZ}" ]
then curl \
--user ${{ env.OBS_USER }}:${{ secrets.OBS_PASSWORD }} \
-X DELETE https://api.opensuse.org/source/${{ env.OBS_PROJECT }}/${{ env.PACKAGE }}/${OLD_DEBIAN_TXZ}
fi
if [ "${OLD_ORIG_TGZ}" ]
then curl \
--user ${{ env.OBS_USER }}:${{ secrets.OBS_PASSWORD }} \
-X DELETE https://api.opensuse.org/source/${{ env.OBS_PROJECT }}/${{ env.PACKAGE }}/${OLD_ORIG_TGZ}
fi
- name: Deploy source package on OBS
run: |
FILES={
FILES+=${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.revision }}.dsc,
FILES+=${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.revision }}.debian.tar.xz,
FILES+=${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}.orig.tar.gz
FILES+=}
curl \
--user ${{ env.OBS_USER }}:${{ secrets.OBS_PASSWORD }} \
https://api.opensuse.org/source/${{ env.OBS_PROJECT }}/${{ env.PACKAGE }}/ \
-T "${FILES}"
- name: Upload source package as artifact
uses: actions/upload-artifact@v4
with:
name: source-package
path: |
${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.revision }}.dsc
${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.revision }}.debian.tar.xz
${{ env.PACKAGE }}_${{ steps.extract.outputs.version }}.orig.tar.gz