Get latest PyTorch version release branch #157
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: Get latest PyTorch version release branch | |
on: | |
workflow_dispatch: | |
env: | |
working_branch: support/new-pytorch-release-branch | |
base_branch: release/1.2.x | |
permissions: | |
contents: write | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository }} == 'hemlholtz-analytics/heat' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ env.base_branch }}' | |
- name: Fetch PyTorch release version | |
run: | | |
curl -sL https://api.github.com/repos/pytorch/pytorch/releases/latest | \ | |
jq -r ".tag_name" | tr -d 'v' > .github/pytorch-release-versions/pytorch-latest.txt | |
- name: Check if file has been modified | |
id: git-check | |
run: echo "::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")" | |
- name: Delete working branch if it already exists | |
run: git push --delete origin ${{ env.working_branch }} || true | |
- name: Commit latest PyTorch release version to new branch | |
if: ${{ steps.git-check.outputs.modified == 'true' }} | |
run: | | |
git checkout -b ${{ env.working_branch }} | |
echo "new=$(<.github/pytorch-release-versions/pytorch-latest.txt)" >> $GITHUB_ENV | |
git config --global user.name 'ClaudiaComito' | |
git config --global user.email '[email protected]@users.noreply.github.com' | |
git commit -am "New PyTorch release ${{ env.new }}" | |
git push --set-upstream origin ${{ env.working_branch }} |