Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add GitHub action to publish to PyPi and GH on tag #41

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 'Publish Release'

on:
push:
tags:
- '*'

jobs:
publish:
name: Publish Release
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Dependencies
uses: './.github/actions/dep-setup'
with:
python-version: '3.10'

- name: Run Safety Check
run: poetry poe safety

- name: Get Python Module Version
run: |
MODULE_VERSION=$(poetry version --short)
echo "MODULE_VERSION=$MODULE_VERSION" >> $GITHUB_ENV

- name: Verify Versions Match
run: |
TAG_VERSION=$(git describe HEAD --tags --abbrev=0)
echo "Git Tag Version: $TAG_VERSION"
echo "Python Module Version: $MODULE_VERSION"
if [[ "$TAG_VERSION" != "$MODULE_VERSION" ]]; then exit 1; fi

- name: Publish to PyPi
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}

- name: Release
uses: softprops/action-gh-release@v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wicked smart dude - big rust person

with:
generate_release_notes: true
files: |
dist/eksupgrade-${{env.MODULE_VERSION}}-py3-none-any.whl
dist/eksupgrade-${{env.MODULE_VERSION}}.tar.gz