Skip to content

Commit

Permalink
Create release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
frozenIceage authored Jul 18, 2024
1 parent f6ead75 commit bf81cdd
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
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 }}"

0 comments on commit bf81cdd

Please sign in to comment.