Skip to content

Commit

Permalink
github actions: Add docopt-lib.sh release job
Browse files Browse the repository at this point in the history
  • Loading branch information
andsens committed May 10, 2024
1 parent 4bcb9f2 commit bd8c73a
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
test:
uses: ./.github/workflows/test.yaml
publish:
pypi-publish:
needs: [test]
runs-on: ubuntu-latest
environment: release
Expand All @@ -31,3 +31,50 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
repository-url: https://test.pypi.org/legacy/
docopt-lib-release:
name: Create docopt-lib.sh GitHub Release
runs-on: ubuntu-latest
steps:
- name: Determine version
id: version
run: printf "tag=%s\n" "${REF#refs\/tags\/}" >> $GITHUB_OUTPUT
env:
REF: ${{ github.ref }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: .devcontainer/post.sh
- name: Set version
run: poetry version ${{ steps.version.outputs.tag }}
- name: Install docopt.sh
run: poetry install
- name: Create release tarball
run: |
mkdir dist
cd dist
.venv/bin/docopt.sh generate-library >docopt-lib.sh
printf '{
"name": "docopt-lib.sh"
"version": "v${{ steps.version.outputs.tag }}"
}'
tar -czf ../docopt-lib.sh-v${{ steps.version.outputs.tag }}.tar.gz *
- name: Get release notes from tag
id: tag-message
run: |
eof="$(openssl rand -hex 8)"
printf "message<<%s\n%s\n%s\n" "$eof" "$(git tag -l --format='%(contents)' "${REF#refs\/tags\/}")" "$eof" >> $GITHUB_OUTPUT
env:
REF: ${{ github.ref }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: ${{ steps.version.outputs.tag }}
body: ${{ steps.tag-message.outputs.message }}
draft: false
prerelease: false
artifacts: docopt-lib.sh-v${{ steps.version.outputs.tag }}.tar.gz
artifactErrorsFailBuild: true
artifactContentType: application/gzip

0 comments on commit bd8c73a

Please sign in to comment.