Make releases with workflow

This commit is contained in:
Eren Dogan 2023-02-13 22:12:36 -08:00
parent 984126f7e0
commit c891a033f2
1 changed files with 27 additions and 1 deletions

View File

@ -5,7 +5,7 @@ on:
- stable - stable
jobs: jobs:
deploy_pip: deploy_pip:
if: ${{ startsWith(github.event.head_commit.message, 'Bump version:') }} if: ${{ startsWith(github.event.head_commit.message, 'Bump version:') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
@ -24,3 +24,29 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
password: ${{ secrets.PYPI_API_TOKEN }} password: ${{ secrets.PYPI_API_TOKEN }}
github_release:
if: ${{ startsWith(github.event.head_commit.message, 'Bump version:') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
- name: Create a release
run: |
# Find the last two commits
export LATEST_TAG="$(git describe --tags --abbrev=0)"
export PREVIOUS_TAG="$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))"
# Write release notes to a file
touch release_notes.txt
printf "## Install\nPython package is available at [PyPI](https://pypi.org/project/openram/).\n" >> release_notes.txt
printf "## Documentation\nDocumentation is available [here](https://github.com/VLSIDA/OpenRAM/blob/stable/docs/source/index.md).\n" >> release_notes.txt
printf "## Changes\n" >> release_notes.txt
printf "Full changelog: https://github.com/VLSIDA/OpenRAM/compare/${PREVIOUS_TAG}...${LATEST_TAG}\n" >> release_notes.txt
printf "## Contributors\n" >> release_notes.txt
printf "$(git log --pretty='format:+ %an' ${LATEST_TAG}...${PREVIOUS_TAG} | sort -u)\n" >> release_notes.txt
# Create the release via GitHub CLI
gh release create ${LATEST_TAG} --verify-tag -F release_notes.txt
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}