Mint release 🍬 #2
This file contains hidden or 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: Mint release 🍬 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Release tag 🏷️ | |
| required: true | |
| default: 0.1.0rc1 | |
| permissions: {} # disables all GitHub permissions for the workflow | |
| jobs: | |
| tag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| pip install pre-commit ruamel.yaml | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "PlasmaPy Release Bot" | |
| - name: Create or checkout branch | |
| run: | | |
| VERSION="v${{ github.event.inputs.tag }}" | |
| BRANCH=$(echo $VERSION | awk 'BEGIN{FS=OFS="."} {$3="x"} 1' | cut -f1,2,3 -d'.' | awk -F'rc' '{print $1 ORS $2}') | |
| git checkout $BRANCH 2>/dev/null || git checkout -b $BRANCH | |
| - name: Tag the release | |
| run: | | |
| git tag "v${{ github.event.inputs.tag }}" -m "Version v${{ github.event.inputs.tag }}" | |
| git tag | |
| - name: Push tag, branch state | |
| run: | | |
| VERSION="v${{ github.event.inputs.tag }}" | |
| BRANCH=$(echo $VERSION | awk 'BEGIN{FS=OFS="."} {$3="x"} 1' | cut -f1,2,3 -d'.' | awk -F'rc' '{print $1 ORS $2}') | |
| git push -u origin $VERSION $BRANCH |