Build and Tag #219
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: Build and Tag | |
on: | |
schedule: | |
- cron: "0 0 * * 1" | |
push: | |
tags-ignore: | |
- '*' | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
tag-dependencies: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[updated]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: "${{secrets.CI_SSH_KEY}}" | |
fetch-depth: '0' | |
persist-credentials: true | |
- name: Set up PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: "3.11" | |
- name: Prepare Release | |
env: | |
GH_EMAIL: ${{ secrets.GH_EMAIL }} | |
GH_USERNAME: ${{ secrets.GH_USERNAME }} | |
run: | | |
git config --global user.email "${GH_EMAIL}" | |
git config --global user.name "${GH_USERNAME}" | |
echo "Updating dependencies" | |
pdm init -n | |
pdm update --update-eager | |
# directory created by pdm init but that we don't need | |
rm -rf src/ | |
echo "Updating version" | |
export CAL_VERSION=`python3 get-next-version.py` | |
echo ${CAL_VERSION} > VERSION | |
echo "Committing current changes" | |
git status | |
git add VERSION pdm.lock | |
git commit -s -m "Prepare ${CAL_VERSION} [updated]" | |
git push | |
echo "Tagging release" | |
git tag -a ${CAL_VERSION} -m "$(printf "Release ${CAL_VERSION}\n\n")" | |
git push --follow-tags origin "${CAL_VERSION}" | |
echo "Tag ${CAL_VERSION} pushed" |