Check rapipdf #3
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
name: Check rapipdf | |
on: | |
schedule: | |
- cron: "30 0 * * *" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: Update flask-openapi3-rapipdf | |
id: update_rapipdf | |
run: | | |
cd ./flask-openapi3-rapipdf/flask_openapi3_rapipdf | |
old_version=$(cat __version__.py | grep -oP '(?<=__version__ = ").*(?=")') | |
new_version=$(npm show rapipdf version) | |
if [ "${new_version}" != "${old_version}" ]; then | |
curl -L https://cdn.jsdelivr.net/npm/rapipdf@${new_version}/dist/rapipdf-min.js \ | |
-o ./templates/rapipdf/js/rapipdf-min.js | |
echo -e "# -*- coding: utf-8 -*-\n\n__version__ = \"${new_version}\"" > __version__.py | |
echo "new_version=${new_version}" >> $GITHUB_OUTPUT | |
echo "is_update=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_update=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Git Commit | |
if: ${{ steps.update_rapipdf.outputs.is_update == 'true' }} | |
id: git_commit | |
run: | | |
new_version=${{ steps.update_rapipdf.outputs.new_version }} | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update rapipdf ${new_version}" | |
git push origin master | |
- name: Release flask-openapi3-rapipdf | |
if: ${{ steps.git_commit.outcome == 'success' }} | |
run: | | |
cd flask-openapi3-rapipdf | |
python -m build | |
twine upload dist/* |