Skip to content

Commit

Permalink
Build the artifact in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Nov 21, 2024
1 parent 275c220 commit 1293da3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: ["trunk"]

permissions:
contents: read

jobs:
tox:
name: "tox -e ${{ matrix.tox-env }}"
Expand All @@ -32,8 +35,8 @@ jobs:
- run: "python -m pip install tox"

# Temporary hack: create files normally created by Webpack that are
# expected to exist by the manifest.json view test.
# Temporary hack: create files normally created by bin/compile-static.py
# that are expected to exist by the manifest.json view test.
- run: |
mkdir yarrharr/static
touch yarrharr/static/{icon,logotype,lettertype}-xyz.{ico,png,svg}
Expand All @@ -42,7 +45,7 @@ jobs:
- run: "python -m tox"

webpack:
build:
name: "tox -e static"

runs-on: ubuntu-24.04
Expand All @@ -67,3 +70,11 @@ jobs:
- run: "python -m tox -e static --notest"

- run: "tox -e static"

- run: "bin/release.sh"

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*.*
if-no-files-found: error
8 changes: 8 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -exu -o pipefail
git diff --quiet HEAD || exit 1
tox -e release --notest
version=$(.tox/release/bin/hatch version)
.tox/release/bin/python -m build
.tox/release/bin/python -m twine check "dist/yarrharr-${version}.tar.gz" "dist/yarrharr-${version}-py3-none-any.whl"
git tag "v${version}"
9 changes: 1 addition & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ _static:
tox -e static

release: _static
#!/usr/bin/env bash
set -exu -o pipefail
git diff --quiet HEAD || exit 1
tox -e release --notest
version=$(grep -oP '(?<=__version__ = ")([^"]+)(?=")' yarrharr/__init__.py)
.tox/release/bin/python -m build
.tox/release/bin/python -m twine check "dist/yarrharr-${version}.tar.gz" "dist/yarrharr-${version}-py3-none-any.whl"
git tag "v${version}"
bin/release.sh

devserver: _static
tox -e run -- django-admin migrate
Expand Down

0 comments on commit 1293da3

Please sign in to comment.