Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Build two downloadable packages. This does not publish to PyPI.
# Uploading to PyPI needs a token or trusted publishing, which this
# repository does not configure. A v* tag attaches the same files to a
# GitHub Release.
# Build two packages and, on main, publish a GitHub Release.
# The release tag is v<version> from setup.py. The same version updates
# that release's files. A new version in setup.py publishes the next one.
# This does not publish to PyPI. That needs a token or trusted publishing.

name: Package

on:
pull_request:
push:
branches: [main]
tags: ["v*"]

jobs:
package:
Expand Down Expand Up @@ -48,7 +47,7 @@ jobs:
path: packages/skills/

release:
if: startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: package
runs-on: ubuntu-latest
permissions:
Expand All @@ -60,16 +59,21 @@ jobs:
path: release
merge-multiple: true

- name: Attach both packages to the GitHub Release
- name: Publish the GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
tag="${GITHUB_REF_NAME}"
archive=$(echo release/pyouter-skills-*.zip)
version=$(basename "$archive" .zip)
version=${version#pyouter-skills-}
tag="v${version}"
notes="Python package and skills package for ${tag}. This release does not publish to PyPI."
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$tag" release/* --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$tag" release/* \
--repo "$GITHUB_REPOSITORY" \
--target "$GITHUB_SHA" \
--title "$tag" \
--notes "Python package and skills package. This release does not publish to PyPI."
--notes "$notes"
fi
Loading