Skip to content

Fix bump workflow #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions .github/chainguard/bump-package.sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
issuer: https://token.actions.githubusercontent.com
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this file is read by https://github.com/octo-sts/app. Plan is to use this from the other repos, rather than relying on a PAT. Of course, that will require installing that GitHub App on the org.

subject_pattern: 'repo:robotpy/mostrobotpy:ref:refs/tags/[1-9]+.*'
claim_pattern:
workflow_ref: 'robotpy/mostrobotpy/\.github/workflows/dist.yml@.*'

permissions:
workflows: write
27 changes: 19 additions & 8 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
---
name: bump

on: [repository_dispatch]
on:
workflow_dispatch:
inputs:
package_name:
description: 'Package to bump'
required: true
package_version:
description: 'Package version'
required: true

jobs:
bump:
if: github.event_name == 'repository_dispatch' && github.event.action == 'tag'
runs-on: ubuntu-latest
env:
PACKAGE_NAME: ${{ github.event.inputs.package_name }}
PACKAGE_VERSION: ${{ github.event.inputs.package_version }}

steps:
- name: Information
run: |
echo "Version update for ${{ github.event.client_payload.package_name }} -> ${{ github.event.client_payload.package_version }} requested"
echo "Version update for $PACKAGE_NAME -> $PACKAGE_VERSION requested"
- uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
Expand All @@ -27,20 +38,20 @@ jobs:
- name: Bump requirements
shell: bash
run: |
python .github/workflows/bump.py ${{ github.event.client_payload.package_name }} ${{ github.event.client_payload.package_version }} "$(git describe --tags)"
python .github/workflows/bump.py "$PACKAGE_NAME" "$PACKAGE_VERSION" "$(git describe --tags)"

- name: Commit and push
shell: bash
run: |
git config --local user.email "action@github.com"
git config --local user.name "Github Action"
git add pyproject.toml
git commit -m "Bump '${{ github.event.client_payload.package_name }}' dependency to '${{ github.event.client_payload.package_version }}'"
git commit -m "Bump '$PACKAGE_NAME' dependency to '$PACKAGE_VERSION'"
git push

- name: Tag and push
shell: bash
run: |
TAG=$(python .github/workflows/tag.py ${{ github.event.client_payload.package_name }} ${{ github.event.client_payload.package_version }} "$(git describe --tags --no-abbrev)")
git tag ${TAG}
git push origin ${TAG}
TAG=$(python .github/workflows/tag.py "$PACKAGE_NAME" "$PACKAGE_VERSION" "$(git describe --tags --no-abbrev)")
git tag "${TAG}"
git push origin "${TAG}"