Skip to content

release

release #86

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
level:
type: choice
description: 'Version level increment'
options:
- patch
- minor
- major
required: true
default: 'patch'
publish:
type: boolean
description: 'Publish package'
required: true
default: false
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: setup environment
run: |
sudo ln -fs /usr/share/zoneinfo/Europe/Stockholm /etc/localtime
sudo ln -fs /usr/share/zoneinfo/Europe/Stockholm /etc/timezone
echo $HOME/.local/bin >> $GITHUB_PATH
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: setup node
id: setup-node
uses: actions/setup-node@v3
- name: get latest tag
uses: mgor/[email protected]
id: get-latest-tag
with:
semver_only: true
initial_version: 'v0.0.0'
with_initial_version: true
- name: next version
uses: mgor/[email protected]
id: next-version
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ github.event.inputs.level }}
- name: create release tag
run: |
echo "current version is ${{ steps.get-latest-tag.outputs.tag }}"
echo "next version is ${{ steps.next-version.outputs.new_version }}"
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${{ steps.next-version.outputs.new_version }}" -m "Release ${{ steps.next-version.outputs.new_version }}"
- name: install python dependencies
id: install-python-deps
run: |
python -m pip install -e .[ci,docs]
- name: build package
id: build
run: python -m build
- name: verify package
id: verify
working-directory: ./dist/
env:
VERSION: ${{ steps.next-version.outputs.new_version }}
run: |
set -e
ls -l grizzly?loadtester-${VERSION#v}*
test -f grizzly-loadtester-${VERSION#v}.tar.gz
test -f grizzly_loadtester-${VERSION#v}-py3-none-any.whl
- name: publish package
id: publish
if: ${{ github.event.inputs.publish == 'true' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: true
VERSION: ${{ steps.next-version.outputs.new_version }}
run: python -m twine upload dist/grizzly?loadtester-${VERSION#v}*
- name: push release tag
id: release-tag
if: ${{ github.event.inputs.publish == 'true' }}
run: git push origin "${{ steps.next-version.outputs.new_version }}"
- name: prepare "edit this page" links
id: edit-this-page-links
run: |
if [[ "${{ github.event.inputs.publish }}" == "true" ]]; then
tag="${{ steps.next-version.outputs.new_version }}"
else
tag="$(git tag | tail -1)"
fi
git checkout -b "${tag}" "tags/${tag}"
- name: build documentation
working-directory: ./docs/
id: build-docs
run: python -m novella --site-dir "./_build" --base-url grizzly/
- name: deploy documentation
id: deploy-docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs/_build
destination_dir: docs/
enable_jekyll: false
# cname: <a better domain>
allow_empty_commit: true
commit_message: 'Documentation for release ${{ steps.next-version.outputs.new_version }}'