Skip to content

Commit

Permalink
pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaseCocoa committed Jun 13, 2024
1 parent 5b2d78f commit 38e5467
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Pulblish to PyPI

on:
release:
types: [released]
workflow_dispatch:
inputs:
version:
description: 'version'
required: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: "Set env"
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
git tag ${{ github.event.inputs.version }}
else
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
fi
- name: echo version
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Publish to PyPI
run: |
pdm publish
41 changes: 41 additions & 0 deletions .github/workflows/upload_pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Pulblish to TestPyPI

on:
release:
types: [prereleased]
workflow_dispatch:
inputs:
version:
description: 'version'
required: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: "Set env"
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
git tag ${{ github.event.inputs.version }}
else
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
fi
- name: echo version
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
- name: Publish to TestPyPI
run: |
pdm publish --repository testpypi

0 comments on commit 38e5467

Please sign in to comment.