Skip to content

Bump werkzeug from 2.3.7 to 3.0.1 in /examples/demo (#161) #47

Bump werkzeug from 2.3.7 to 3.0.1 in /examples/demo (#161)

Bump werkzeug from 2.3.7 to 3.0.1 in /examples/demo (#161) #47

name: publish-to-pypi
on:
push:
branches:
- main
jobs:
publish-to-pypi:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install dependencies
run: npm install @iarna/toml
- name: Check for version changes
id: check_version
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
const execSync = require('child_process').execSync;
const toml = require('@iarna/toml');
const current = fs.readFileSync('pyproject.toml', 'utf8');
execSync('git checkout HEAD^1 pyproject.toml');
const previous = fs.readFileSync('pyproject.toml', 'utf8');
execSync('git checkout HEAD pyproject.toml');
const currentVersion = toml.parse(current).tool.poetry.version;
const previousVersion = toml.parse(previous).tool.poetry.version;
const versionChanged = currentVersion !== previousVersion;
if (versionChanged) {
console.log(`version changed from ${previousVersion} to ${currentVersion}`);
return currentVersion;
} else {
console.log(`version did not change from ${previousVersion}`);
}
- name: Install Poetry
if: ${{ steps.check_version.outputs.result }}
uses: snok/install-poetry@v1
with:
version: 1.5.1
- name: Build and publish
if: ${{ steps.check_version.outputs.result }}
run: |
echo "Building version ${{ steps.check_version.outputs.result }} ..."
poetry build
echo "Publishing ..."
poetry publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}