forked from SUSE/osc-tiny
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (56 loc) · 2.01 KB
/
publish.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
name: Push to PyPI
on:
release:
types: [released]
jobs:
release-obs:
name: Release on OBS
runs-on: ubuntu-latest
env:
OBS_API: https://api.opensuse.org/
PROJECT: openSUSE:Factory
PACKAGE: osc-tiny
steps:
- uses: actions/checkout@master
- name: Get latest release tag
id: get_latest_release
run: echo "LATEST_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Install osc
run: |
sudo apt-get update -y
sudo apt-get install -y osc
- name: Config osc
run: |
cat <<EOF > $HOME/.oscrc
[general]
apiurl=$OBS_API
[$OBS_API]
user = ${{ secrets.OSC_USER }}
pass = ${{ secrets.OSC_PASS }}
EOF
- name: checkout package
run: osc branchco $PROJECT python-$PACKAGE
- name: Fetch tarball from PyPI
run: |
cd home:*:branches:*/python-$PACKAGE
osc rm *.tar.gz
FILE_NAME=osc_tiny-${{ env.LATEST_TAG }}.tar.gz
FILE_URL=https://files.pythonhosted.org/packages/source/o/osc-tiny
while [ ! -f "$FILE_NAME" ]; do
echo "File not found. Downloading..."
wget "$FILE_URL/$FILE_NAME"
if [ ! -f "$FILE_NAME" ]; then
echo "Download failed. Waiting for 2 seconds before retrying..."
sleep 2
fi
done
osc add $FILE_NAME
- name: Update spec and changes files
run: |
cd home:*:branches:*/python-$PACKAGE
sed -i "s/^Version:.*/Version: ${{ env.LATEST_TAG }}/" *.spec
sed -i "s/%setup -q -n osc-tiny-%{version}/%setup -q -n osc_tiny-%{version}/" *.spec
sed -i "s|Source: $FILE_URL/osc-tiny-%{version}.tar.gz|Source: $FILE_URL/osc_tiny-%{version}.tar.gz|" *.spec
osc vc -m "Release ${{ env.LATEST_TAG }}"
osc commit -m "Release version ${{ env.LATEST_TAG }}" --noservice
osc submitrequest -m "Release ${{ env.LATEST_TAG }}"