Skip to content

Commit

Permalink
Update python-app.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
priyagupta108 authored Oct 28, 2024
1 parent f3adf1f commit 2030e4e
Showing 1 changed file with 40 additions and 60 deletions.
100 changes: 40 additions & 60 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,46 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Test Publish Release

on:
push:
branches: [ "main" ]

# push:
workflow_dispatch:
inputs:
tool-version:
description: 'The version of the tool to release'
required: true
default: 'v1.0.0'
# tags:
# - "v*"

permissions:
contents: write

jobs:
# test:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-python@v2
# with:
# python-version: 3.7
# - run: |
# echo $PATH
# python --version
# which python
# - run: |
# echo $PATH
# python --version
# which python
# shell: bash {0}
# - run: |
# echo $PATH
# python --version
# which python
# shell: bash -l {0}


deploy:

runs-on: macos-latest

release:
name: Release pushed tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8.10"





- name: Checkout repository
uses: actions/checkout@v4
- name: Configure Git User
run: |
git config --global user.email "priyagupta108@github.com"
git config --global user.name "priya gupta"
- name: Tag and Push Release
run: |
git tag -a v1.0.0 -m "Initial release"
git push origin v1.0.0
- name: Publish Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
LATEST_COMMIT=$(git rev-parse HEAD)
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
gh release create $LATEST_COMMIT --draft --title "Release $LATEST_COMMIT" \
--tag "${{ inputs.tool-version }}-${{ github.run_id }}" \
--notes "${{ steps.generate-release-body.outputs.RELEASE_BODY }}" \
"https://github.com/priyagupta108/sample-python/archive/refs/tags/$LATEST_TAG.zip#sample-python-$LATEST_TAG.zip" \
"https://github.com/priyagupta108/sample-python/archive/refs/tags/$LATEST_TAG.tar.gz#sample-python-$LATEST_TAG.tar.gz"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 2030e4e

Please sign in to comment.