yuvipanda / hubtraf

Traffic simulator for JupyterHub
BSD 3-Clause "New" or "Revised" License
40 stars 24 forks source link

Draft notes on setting up RELEASE.md and release.yaml #40

Open consideRatio opened 1 year ago

consideRatio commented 1 year ago

This project doesn't make releases, so installing it has been done from the main branch.

The project includes a Dockerfile, a Helm chart, a Python package, and docs. I think making sure the docs and python package is published with various versions would make sense.

Below is a proposal for a release.yaml to be accompanied with a RELEASE.md like for example in tmpauthenticator that also is light-weight and doesn't come with a conda-forge package.

# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
name: Release

# Always tests wheel building, but only publish to PyPI on pushed tags.
on:
  pull_request:
    paths-ignore:
      - "docs/**"
      - ".github/workflows/*.yaml"
      - "!.github/workflows/release.yaml"
  push:
    paths-ignore:
      - "docs/**"
      - ".github/workflows/*.yaml"
      - "!.github/workflows/release.yaml"
    branches-ignore:
      - "dependabot/**"
      - "pre-commit-ci-update-config"
    tags: ["**"]
  workflow_dispatch:

jobs:
  # FIXME: Publish a PyPI package and register this workflow as trusted via
  #        PyPI, and write RELEASE.md like in
  #        https://github.com/jupyterhub/tmpauthenticator/blob/main/RELEASE.md
  #        that matches this repo by not having a conda-forge package etc.
  #
  build-release:
    runs-on: ubuntu-22.04
    permissions:
      # id-token=write is required for pypa/gh-action-pypi-publish, and the PyPI
      # project needs to be configured to trust this workflow.
      #
      # ref: https://github.com/jupyterhub/team-compass/issues/648
      #
      id-token: write

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: "3.11"

      - name: install build package
        run: |
          pip install --upgrade pip
          pip install build
          pip freeze

      - name: build release
        run: |
          python -m build --sdist --wheel .
          ls -l dist

      - name: publish to pypi
        uses: pypa/gh-action-pypi-publish@release/v1
        if: startsWith(github.ref, 'refs/tags/')

  # FIXME: Consider if and how...
  #        
  #        - The helm chart should(?) be packaged and published with releases
  #        - The Dockerfile should(?) be build and pushed with releases
  #