-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 misc: add continuous deployment workflow
- Loading branch information
Showing
2 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
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,35 @@ | ||
name: Continuous Deployment | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy and release | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate the changelog | ||
uses: orhun/git-cliff-action@main | ||
id: git-cliff | ||
with: | ||
config: cliff.toml | ||
args: --latest --strip all | ||
env: | ||
OUTPUT: CHANGES.md | ||
|
||
- name: Create GitHub release | ||
run: | | ||
gh release create ${{ github.ref_name }} \ | ||
--title "Release ${{ github.ref_name }}" \ | ||
--notes "${{ steps.git-cliff.outputs.content }}" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
|
@@ -3,6 +3,12 @@ | |
# Inspired by https://github.com/orhun/git-cliff/blob/main/release.sh | ||
set -eu | ||
|
||
# Check for a clean working directory. | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "Your working directory is dirty. Commit or stash your changes before running this script." | ||
exit 1 | ||
fi | ||
|
||
# Check if a version tag is provided. | ||
if [ "$#" -eq 1 ]; then | ||
VERSION_TAG=$1 | ||
|
@@ -113,12 +119,8 @@ git show $VERSION_TAG | |
echo | ||
|
||
echo "Release $VERSION_TAG is ready. Don't forget to push the changes and the tag:" | ||
echo "git push && git push --tags" | ||
echo | ||
echo "Once that's done, you should see your tag on GitHub:" | ||
|
||
remote_url=$(git remote get-url origin) | ||
|
||
# Check if the URL is in SSH format (git@). | ||
if [[ "$remote_url" == [email protected]:* ]]; then | ||
https_url="https://github.com/${remote_url#git@github.com:}" | ||
|
@@ -127,7 +129,7 @@ else | |
https_url="${remote_url%.git}" | ||
fi | ||
|
||
echo "${https_url}/tags" | ||
echo "git push && git push --tags && open ${https_url}/tags" | ||
|
||
echo "To publish on PyPI, run:" | ||
echo "poetry publish --build" |