|
7 | 7 | jobs:
|
8 | 8 | test:
|
9 | 9 | uses: ./.github/workflows/test.yaml
|
10 |
| - publish: |
| 10 | + pypi-publish: |
| 11 | + name: Publish docopt.sh to PyPI |
11 | 12 | needs: [test]
|
12 | 13 | runs-on: ubuntu-latest
|
13 | 14 | environment: release
|
|
29 | 30 | run: poetry build
|
30 | 31 | - name: Publish package distributions to PyPI
|
31 | 32 | uses: pypa/gh-action-pypi-publish@release/v1.8
|
| 33 | + docopt-lib-release: |
| 34 | + needs: [test] |
| 35 | + name: Create docopt-lib.sh GitHub Release |
| 36 | + runs-on: ubuntu-latest |
| 37 | + environment: release |
| 38 | + steps: |
| 39 | + - name: Determine version |
| 40 | + id: version |
| 41 | + run: printf "tag=%s\n" "${REF#refs\/tags\/}" >> $GITHUB_OUTPUT |
| 42 | + env: |
| 43 | + REF: ${{ github.ref }} |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + ref: ${{ steps.version.outputs.tag }} |
| 47 | + - name: Set up Python |
| 48 | + uses: actions/setup-python@v5 |
| 49 | + with: |
| 50 | + python-version: '3.11' |
| 51 | + - name: Create release tarball |
| 52 | + run: | |
| 53 | + .devcontainer/post.sh |
| 54 | + poetry version ${{ steps.version.outputs.tag }} |
| 55 | + poetry install |
| 56 | + mkdir dist |
| 57 | + .venv/bin/docopt.sh generate-library >dist/docopt-lib.sh |
| 58 | + cd dist |
| 59 | + printf '{ |
| 60 | + "name": "docopt-lib.sh" |
| 61 | + "version": "${{ steps.version.outputs.tag }}" |
| 62 | + }' >upkg.json |
| 63 | + tar -czf ../docopt-lib.sh-${{ steps.version.outputs.tag }}.tar.gz * |
| 64 | + - name: Get release notes from tag |
| 65 | + id: tag-message |
| 66 | + run: | |
| 67 | + eof="$(openssl rand -hex 8)" |
| 68 | + msg=$(git tag -l --format='%(contents)' "${{ steps.version.outputs.tag }}") |
| 69 | + msg=${msg%%'-----BEGIN'*} |
| 70 | + printf "message<<%s\n%s\n%s\n" "$eof" "$msg" "$eof" >> $GITHUB_OUTPUT |
| 71 | + env: |
| 72 | + REF: ${{ github.ref }} |
| 73 | + - name: Create Release |
| 74 | + uses: ncipollo/release-action@v1 |
| 75 | + with: |
| 76 | + name: ${{ steps.version.outputs.tag }} |
| 77 | + body: ${{ steps.tag-message.outputs.message }} |
| 78 | + draft: false |
| 79 | + prerelease: false |
| 80 | + artifacts: docopt-lib.sh-${{ steps.version.outputs.tag }}.tar.gz |
| 81 | + artifactErrorsFailBuild: true |
| 82 | + artifactContentType: application/gzip |
0 commit comments