Skip to content

Commit

Permalink
add release script
Browse files Browse the repository at this point in the history
  • Loading branch information
diversemix committed Aug 19, 2024
1 parent f254de1 commit 59febc9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
branches:
- main

permissions: write-all
permissions: read-all

jobs:
code-quality:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Create Release

on:
push:
tags:
- v*.*.* # Triggers the workflow on version tags like v1.0.0

permissions: read-all

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "export PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: poetry install --no-interaction --no-ansi

- name: Build the package
run: poetry build

- name: Extract version
id: get_version
run: echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }} # Use the tag that triggered the workflow
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Wheel Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/say_hello-${{ env.VERSION }}-py3-none-any.whl
asset_name: say_hello-${{ env.VERSION }}-py3-none-any.whl
asset_content_type: application/zip

- name: Upload Source Distribution Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/say_hello-${{ env.VERSION }}.tar.gz
asset_name: say_hello-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip

0 comments on commit 59febc9

Please sign in to comment.