Skip to content

0.1.5

0.1.5 #42

Workflow file for this run

name: Release
on:
release:
types: [ published ]
branches:
- 'main'
env:
UPLOAD_URL: ${{ github.event.release.upload_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
name: Release
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
python-version: [ '3.10' ]
runs-on: ${{ matrix.os }}
permissions: write-all
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build Package
run: |
python setup.py bdist
- name: Get Package Name (Windows)
if: matrix.os == 'windows-latest'
run: |
$path_separator = "\\"
$latestFile = Get-ChildItem -Path "dist\\" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
Write-Host "Latest file: $latestFile"
Write-Output "PACKAGE_PATH=dist$path_separator$($latestFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Output "PACKAGE_NAME=$($latestFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Get Package Name (Ubuntu and macOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
path_separator="/"
latestFile=$(ls -t dist/ | head -n 1)
echo "Latest file: $latestFile"
echo "PACKAGE_PATH=dist$path_separator$latestFile" >> $GITHUB_ENV
echo "PACKAGE_NAME=$latestFile" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ${{ env.PACKAGE_PATH }}
asset_name: ${{ env.PACKAGE_NAME }}
asset_content_type: application/octet-stream
publish:
name: Publish
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10' ]
runs-on: ${{ matrix.os }}
permissions: write-all
needs: [ release ]
steps:
- name: Publish Release
run: |
curl -X PATCH \
-H "Authorization: Bearer ${{ env.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"draft": false}' \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"