-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update workflows; add logic for release workflow
- Loading branch information
1 parent
056d590
commit 4063f99
Showing
6 changed files
with
154 additions
and
125 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Publish Release on Merge to Master | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: | ||
- closed | ||
|
||
jobs: | ||
publish-release-draft: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.MINITRINO_TOKEN }} | ||
run: |- | ||
RELEASE_NOTES=./release-notes/"${GITHUB_HEAD_REF}".md | ||
DESCRIPTION=$(cat "${RELEASE_NOTES}") | ||
if [ ! -f "${RELEASE_NOTES}" ]; then | ||
echo "Release notes file not found at ${RELEASE_NOTES}. Exiting..." | ||
exit 1 | ||
fi | ||
echo "Checking if release exists..." | ||
if gh release list | grep -q -e "${GITHUB_HEAD_REF}"; then | ||
echo "Release ${GITHUB_HEAD_REF} found. Deleting release..." | ||
gh release delete "${GITHUB_HEAD_REF}" -y --cleanup-tag | ||
fi | ||
echo "Creating release from branch ${GITHUB_HEAD_REF}..." | ||
gh release create "${GITHUB_HEAD_REF}" \ | ||
--prerelease \ | ||
--draft=true \ | ||
--title "${GITHUB_HEAD_REF}" \ | ||
--notes "${DESCRIPTION}" \ | ||
--target "${GITHUB_HEAD_REF}" | ||
publish-release: | ||
runs-on: ubuntu-22.04 | ||
needs: publish-release-draft | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Publish release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.MINITRINO_TOKEN }} | ||
run: |- | ||
gh release edit "${GITHUB_HEAD_REF}" \ | ||
--prerelease=false \ | ||
--draft=false \ | ||
--latest | ||
pypi-publish: | ||
runs-on: ubuntu-22.04 | ||
needs: publish-release | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: |- | ||
pip install wheel twine | ||
- name: Build and check distribution | ||
run: |- | ||
cd src/cli | ||
python setup.py sdist bdist_wheel | ||
twine check dist/* | ||
- name: Publish distribution to PyPi | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: twine upload src/cli/dist/* | ||
- name: Check package | ||
run: |- | ||
pip uninstall -y minitrino | ||
pip install minitrino==${GITHUB_HEAD_REF} | ||
minitrino --help || exit 1 |
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
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