55 types : [released, prereleased]
66
77jobs :
8- build :
8+ publish :
99 runs-on : ubuntu-latest
1010
11+ permissions :
12+ id-token : write # required to push with trusted-pypi-token
13+ contents : write # required to push
14+
15+ env :
16+ BRANCH : ${{ github.event.release.target_commitish }}
17+
1118 steps :
1219 - uses : actions/checkout@v4
1320 with :
@@ -47,66 +54,13 @@ jobs:
4754
4855 - name : List contents of wheel
4956 run : python -m zipfile --list dist/servicex_analysis_utils-*.whl
50-
51- - name : Upload an artifact of dist
52- uses : actions/upload-artifact@v4
53- with :
54- name : dist-gha-artifact
55- path : dist
56-
57- publish :
58- needs : build
59- runs-on : ubuntu-latest
60-
61- permissions :
62- id-token : write # required to push with trusted-pypi-token
6357
64- steps :
65- - name : Set up Python 3.12
66- uses : actions/setup-python@v5
67- with :
68- python-version : ' 3.12'
69-
70- - name : Download artifact
71- uses : actions/download-artifact@v4
72- with :
73- name : dist-gha-artifact
74- path : dist
75-
7658 - name : Publish distribution
7759 uses : pypa/gh-action-pypi-publish@v1.12.3
7860 with :
7961 print-hash : true
80-
81- commit-version-bump :
82- needs :
83- - build
84- - publish
85- runs-on : ubuntu-latest
86- permissions :
87- contents : write # required to push with GITHUB_TOKEN
88-
89- steps :
90- - name : Checkout main branch
91- uses : actions/checkout@v4
92- with :
93- ref : main
94-
95- - name : Set up Python 3.12
96- uses : actions/setup-python@v5
97- with :
98- python-version : ' 3.12'
9962
100- - name : Set env
101- run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
102-
103- - name : Update version to commit
104- run : |
105- sed -i 's/^version\s*=\s*".*"/version = "${{ env.RELEASE_VERSION }}"/' pyproject.toml
106- sed -i '/__version__/ s/__version__\s*=.*/__version__ = "${{ env.RELEASE_VERSION }}"/' servicex_analysis_utils/__init__.py
107-
108-
109- - name : Commit version change
63+ - name : Commit version change to branch
11064 run : |
11165 git config --local user.name "github-actions[bot]"
11266 git config --local user.email "github-actions[bot]@users.noreply.github.com"
@@ -120,8 +74,13 @@ jobs:
12074 echo "No changes to commit"
12175 fi
12276
123- - name : Push commit to main
77+ - name : move tag
78+ run : |
79+ git tag -f ${{ env.RELEASE_VERSION }} -m "$(git tag -l --format='%(contents)' ${{ env.RELEASE_VERSION }})"
80+
81+ - name : Push commit to branch & new tag
12482 # GITHUB_TOKEN is automatically provided
12583 run : |
12684 git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
127- git push origin main
85+ git push origin HEAD:$BRANCH
86+ git push origin --force ${{ env.RELEASE_VERSION }}
0 commit comments