forked from SUSE/osc-tiny
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6ead75
commit bf81cdd
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Release on OBS | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release-obs: | ||
name: Release on OBS | ||
runs-on: ubuntu-latest | ||
env: | ||
OBS_API: https://api.opensuse.org/ | ||
PROJECT: home:ChHuang | ||
steps: | ||
- name: Install osc | ||
run: | | ||
apt-get update -y | ||
apt-get install -y osc | ||
- name: Config osc | ||
run: >- | ||
cat > $HOME/.oscrc <<EOF | ||
[general] | ||
apiurl=$OBS_API | ||
[$OBS_API] | ||
user = ${{ secrets.OSC_USER }} | ||
pass = ${{ secrets.OSC_PASS }} | ||
EOF | ||
- name: checkout package | ||
run: | | ||
osc branch $PROJECT $PACKAGE | ||
cd $PACKAGE | ||
rm $PACKAGE*.tar.gz | ||
- name: Fetch tarball from PyPI | ||
id: fetch-tarball | ||
run: | | ||
VERSION=${{ github.event.release.tag_name }} | ||
FILE_NAME=osc-tiny-$VERSION.tar.gz | ||
FILE_URL="https://files.pythonhosted.org/packages/source/o/osc-tiny/osc_tiny-$VERSION.tar.gz -O $FILE_NAME" | ||
echo "::set-output name=version::$VERSION" | ||
while [ ! -f "$FILE_NAME" ]; do | ||
echo "File not found. Downloading..." | ||
curl -O $FILE_URL | ||
if [ ! -f "$FILE_NAME" ]; then | ||
echo "Download failed. Waiting for 2 seconds before retrying..." | ||
sleep 2 | ||
fi | ||
done | ||
echo "File downloaded successfully!" | ||
- name: Update version in spec file | ||
run: | | ||
sed -i "s/^Version:.*/Version: ${{ steps.fetch-tarball.outputs.version }}/" *.spec | ||
- name: Commit and push changes | ||
run: | | ||
osc vc -m 'Update to version ${{ steps.fetch-tarball.outputs.version }}' | ||
osc commit -m "Update to version ${{ steps.fetch-tarball.outputs.version }}" | ||
- name: Submit changes to OBS | ||
run: | | ||
osc submitrequest -m "Update package to version ${{ steps.fetch-tarball.outputs.version }}" |