Skip to content

Commit 4c41522

Browse files
committed
github actions: Add docopt-lib.sh release job
1 parent 4a6fc61 commit 4c41522

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

.github/workflows/release.yaml

+52-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
jobs:
88
test:
99
uses: ./.github/workflows/test.yaml
10-
publish:
10+
pypi-publish:
11+
name: Publish docopt.sh to PyPI
1112
needs: [test]
1213
runs-on: ubuntu-latest
1314
environment: release
@@ -29,3 +30,53 @@ jobs:
2930
run: poetry build
3031
- name: Publish package distributions to PyPI
3132
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

Comments
 (0)