A nice release flow is fully automatic. You push a version tag, and a workflow builds the package, and publishes a GitHub release with notes and files. No manual steps, no forgotten files.
This workflow runs only when a tag starting with v is pushed. It needs write permission on contents, to create the release. It builds a package named after the tag, using github dot ref name. And the release action creates the GitHub release, and attaches the file.
.github/workflows/release.ymlyaml
name: Releaseon: push: tags: ["v*"]permissions: contents: writejobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build the package run: tar -czf shop-${{ github.ref_name }}.tar.gz app.py - name: Show it run: ls *.tar.gz - uses: softprops/action-gh-release@v2 with: files: shop-*.tar.gz
Our helper can pretend a tag was pushed. First, a normal push to main. It isn't triggered, because the workflow only runs for tags. Now, with the tag v one point two point zero, it runs, and builds shop dash v one point two point zero dot tar dot GZ.
Terminal
run-steps .github/workflows/release.ymlWorkflow: Release (event: push, branch: main) Not triggered: this workflow only runs for tagsrun-steps .github/workflows/release.yml --tag v1.2.0Workflow: Release (event: push, tag: v1.2.0)Job: release ↷ uses actions/checkout@v4 (GitHub only) ✓ Build the package ✓ Show it shop-v1.2.0.tar.gz ↷ uses softprops/action-gh-release@v2 (GitHub only) Job succeeded