55 types : [closed]
66
77jobs :
8- getPackages :
8+ GetVersion :
99 runs-on : ubuntu-latest
10+ timeout-minutes : 60
1011 outputs :
11- matrix : ${{ env.matrix }}
12- steps :
13- - name : Checkout repository
14- uses : actions/checkout@v3
15- - id : set-matrix
16- run : echo "matrix=$(./scripts/getPackages.sh)" >> $GITHUB_ENV
17- Publish :
18- name : Publish python packages to pypi
19- needs :
20- - getPackages
21- strategy :
22- matrix : ${{fromJSON(needs.getPackages.outputs.matrix)}}
12+ version : ${{ env.RELEASE_VERSION }}
2313 if : |
2414 github.event.pull_request.user.login == 'polywrap-build-bot' &&
2515 github.event.pull_request.merged == true
26- runs-on : ubuntu-18.04
2716 steps :
28- - name : Checkout
29- uses : actions/checkout@v3
30- with :
31- ref : ${{ github.event.pull_request.base.ref }}
32-
17+ - name : Checkout code
18+ uses : actions/checkout@v2
19+ - name : Halt release if CI failed
20+ run : exit 1
21+ if : ${{ github.event.workflow_run.conclusion == 'failure' }}
3322 - name : Read VERSION into env.RELEASE_VERSION
3423 run : echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
35-
36- - name : Is Pre-Release
24+ - name : Check if tag Exists
25+ id : tag_check
26+ shell : bash -ex {0}
3727 run : |
38- STR="${RELEASE_VERSION}"
39- SUB='pre.'
40- if [[ "$STR" == *"$SUB"* ]]; then
41- echo PRE_RELEASE=true >> $GITHUB_ENV
42- else
43- echo PRE_RELEASE=false >> $GITHUB_ENV
28+ GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}"
29+ http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
30+ -H "Authorization: token ${GITHUB_TOKEN}")
31+ if [ "$http_status_code" -ne "404" ] ; then
32+ exit 1
4433 fi
45- - name : Set up Python 3.10
46- uses : actions/setup-python@v4
47- with :
48- python-version : " 3.10"
34+ env :
35+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4936
50- - name : Install python packages
51- run : poetry install
52- working-directory : ./packages/${{ matrix.package }}
53-
54- - name : Publish python package to pypi
55- run : poetry publish --build --username __token__ --password ${{secrets.POLYWRAP_BUILD_BOT_PYPI_PAT}}
56- working-directory : ./packages/${{ matrix.package }}
57-
58- - uses : actions/github-script@0.8.0
37+ Github-release :
38+ name : Create Release
39+ runs-on : ubuntu-latest
40+ needs :
41+ - GetVersion
42+ steps :
43+ - name : Checkout code
44+ uses : actions/checkout@v2
45+ - name : print version with needs
46+ run : echo ${{ needs.GetVersion.outputs.version }}
47+ - id : changelog
48+ name : " Generate release changelog"
49+ uses : heinrichreimer/github-changelog-generator-action@v2.3
50+ with :
51+ unreleasedOnly : true
52+ unreleasedLabel : ${{ needs.GetVersion.outputs.version }}
53+ token : ${{ secrets.GITHUB_TOKEN }}
54+ continue-on-error : true
55+ - name : Create Release
56+ id : create_release
57+ uses : actions/create-release@v1
58+ env :
59+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5960 with :
60- github-token : ${{secrets.GITHUB_TOKEN}}
61- script : |
62- github.issues.createComment({
63- issue_number: context.issue.number,
64- owner: context.repo.owner,
65- repo: context.repo.repo,
66- body: '**[NPM Release Published](https://www.npmjs.com/search?q=polywrap) `${{env.RELEASE_VERSION}}`** 🎉'
67- })
61+ tag_name : ${{ needs.GetVersion.outputs.version }}
62+ release_name : Release ${{ needs.GetVersion.outputs.version }}
63+ body : ${{ steps.changelog.outputs.changelog }}
64+ draft : true
65+ prerelease : false
0 commit comments