Skip to content
Latchkey

Upload Python Package workflow (hiddify/Hiddify-Reality-Scanner)

The Upload Python Package workflow from hiddify/Hiddify-Reality-Scanner, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: hiddify/Hiddify-Reality-Scanner.github/workflows/release.ymlLicense UnlicenseView source

What it does

This is the Upload Python Package workflow from the hiddify/Hiddify-Reality-Scanner repository, a real project running GitHub Actions. It is shown here with attribution under its Unlicense license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Upload Python Package

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - '*' # Push events to matching v*, i.e. v1.0, v20.15.10

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  release:
    name: Create Release
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
        with:
          # by default, it uses a depth of 1
          # this fetches all history so that we can read each commit
          fetch-depth: 0
      - name: Generate Changelog
        run: .github/release_message.sh > release_message.md
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: release_message.md

  deploy:
    needs: release
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine
    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        python setup.py sdist bdist_wheel
        twine upload dist/*

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Upload Python Package
 
on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - '*' # Push events to matching v*, i.e. v1.0, v20.15.10
 
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  release:
    timeout-minutes: 30
    name: Create Release
    runs-on: latchkey-small
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
        with:
          # by default, it uses a depth of 1
          # this fetches all history so that we can read each commit
          fetch-depth: 0
      - name: Generate Changelog
        run: .github/release_message.sh > release_message.md
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: release_message.md
 
  deploy:
    timeout-minutes: 30
    needs: release
    runs-on: latchkey-small
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        cache: 'pip'
        python-version: '3.x'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine
    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        python setup.py sdist bdist_wheel
        twine upload dist/*
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow