ci: add release files #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Beta Bump | |
on: | |
# schedule: | |
# - cron: "0 0 * * *" | |
push: | |
branches: | |
- ci/* | |
workflow_dispatch: | |
jobs: | |
check-and-bump: | |
environment: production | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check current commit | |
run: | | |
COMMIT_MSG=$(git log --format=%B -n 1) | |
echo "Checking commit message: $COMMIT_MSG" | |
if [[ $COMMIT_MSG == bump:* ]]; then | |
echo "Current commit is a bump, skipping" | |
exit 0 | |
fi | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install hatch | |
run: pip install hatch | |
- name: Configure Git | |
run: | | |
git config --global user.name 'safety-bot' | |
git config --global user.email '[email protected]' | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.SAFETY_BOT_GPG_KEY }} | |
passphrase: ${{ secrets.SAFETY_BOT_GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: true | |
- name: Get current version | |
id: current-version | |
run: | | |
CURRENT_VERSION=$(hatch version) | |
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
if [[ $CURRENT_VERSION =~ .*b[0-9]+$ ]]; then | |
echo "is_beta=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_beta=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Skip bump for beta version | |
if: steps.current-version.outputs.is_beta == 'true' | |
id: skip-bump | |
run: echo "bumped=false" >> $GITHUB_OUTPUT | |
- name: Beta bump | |
id: beta-bump | |
if: steps.current-version.outputs.is_beta != 'true' | |
run: | | |
if hatch run beta-bump; then | |
echo "bumped=true" >> $GITHUB_OUTPUT | |
else | |
echo "bumped=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Push changes | |
if: steps.beta-bump.outputs.bumped == 'true' | |
run: | | |
git push --follow-tags |