Skip to content

Publish release

Publish release #65

Workflow file for this run

name: Publish release
on:
workflow_dispatch:
inputs:
version:
description: 'New version number'
required: true
jobs:
build:
if: contains('["chrispyles"]', github.actor)
runs-on: ubuntu-latest
env:
TAR: /bin/tar
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Only allow releases off of master (or temp for patches)
run: |
python3 -c 'import os, sys; sys.exit(os.environ["GITHUB_REF"] != "refs/heads/master" and os.environ["GITHUB_REF"] != "refs/heads/temp")'
- uses: liskin/gh-pipx@v1
with:
packages: >-
poetry
- uses: actions/checkout@v2
- name: Install dependencies
run: |
poetry install --with dev --no-root
pip install twine
- name: Update versions
run: |
python3 release.py ${{ github.event.inputs.version }}
- name: Build tutorial
run: |
make tutorial
- name: Commit and push
run: |
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release
git commit -am 'release v${{ github.event.inputs.version }}'
git push --set-upstream origin release
- name: Create dist and push to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
python3 -m twine upload dist/*
- name: Create a release on GitHub
env:
GITHUB_USER: ${{ secrets.GITHUB_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create \
--title 'v${{ github.event.inputs.version }}' \
--target release \
'v${{ github.event.inputs.version }}' \
dist/*.tar.gz \
dist/*.whl
- name: Create a latest tag
run: |
git tag -f latest
git push --force origin latest
- name: PR release -> main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--repo ucbds-infra/otter-grader \
--base master \
--head ucbds-infra:release \
--label "release" \
--reviewer chrispyles \
--milestone "v${{ github.event.inputs.version }}" \
--title "Release v${{ github.event.inputs.version }}" \
--body "Updates from the release of version ${{ github.event.inputs.version }}"