Merge pull request #42 from cmu-delphi/dev #2
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: Release Helper | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
correct_repository: | |
runs-on: ubuntu-latest | |
steps: | |
- name: fail on fork | |
if: github.repository_owner != 'cmu-delphi' | |
run: exit 1 | |
create_release: | |
needs: correct_repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Extract version | |
id: extract_version | |
run: | | |
python -m pip install bump2version | |
NEXT_TAG=$(bump2version --dry-run --list patch | grep ^current_version | sed -r s,"^.*=",,) | |
echo "version=$NEXT_TAG" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
version: ${{ steps.extract_version.outputs.version }} | |
publish: true | |
outputs: | |
version: ${{ steps.extract_version.outputs.version }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
tag_name: ${{ steps.create_release.outputs.tag_name }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install build dependencies | |
run: | | |
make install | |
- name: Linting | |
run: | | |
make lint | |
- name: Testing | |
run: | | |
make test | |
build: | |
needs: [create_release, lint] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install build dependencies | |
run: | | |
make install | |
- name: Build | |
run: | | |
make dist | |
release_package: | |
needs: [create_release, lint] | |
runs-on: ubuntu-latest | |
# TODO: Make sure this works, copied from best practices here | |
# https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing | |
environment: | |
name: pypi | |
url: https://pypi.org/p/epidatpy | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: epidatpy | |
path: dist/*.tar.gz | |
- name: Upload Release Asset | |
uses: AButler/[email protected] | |
with: | |
files: "dist/*.tar.gz" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ needs.create_release.outputs.tag_name }} | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
# repository_url: https://test.pypi.org/legacy/ | |
sync_dev: | |
needs: correct_repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }} | |
- name: Reset dev branch | |
run: | | |
git fetch origin main:main | |
git reset --hard main | |
- name: Create pull request into dev | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
branch: bot/sync-main-dev | |
commit-message: "chore: sync main-dev" | |
base: dev | |
title: "chore: sync main->dev" | |
labels: chore | |
# reviewers: | |
assignees: dshemetov | |
body: | | |
Syncing Main->Dev. |