~vejnar/FONtools

ref: 45f1e986905c78cec6190c501d044f2601b11b9c FONtools/.build.yml -rw-r--r-- 1.2 KiB
45f1e986vejnar Switch to Git tag for PyPI version 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
image: archlinux
oauth: git.sr.ht/OBJECTS:RW git.sr.ht/REPOSITORIES:RO git.sr.ht/PROFILE:RO
sources:
    - git@git.sr.ht:~vejnar/FONtools
environment:
    repo: FONtools
    packages: hut python-build twine
secrets:
    - 0fa4be0f-f0ac-4763-855d-51d208629cfe # PyPI token
tasks:
    - update: |
        sudo pacman -Sy --noconfirm --noprogressbar archlinux-keyring
        sudo pacman -Syu --noconfirm --noprogressbar $packages
    - archive-tag: |
        cd $repo
        tag=$(git describe --exact-match 2>/dev/null || true)
        if [ -z "$tag" ]; then
            echo "Current commit is not a tag; abort task"
            exit 0
        fi

        # Publish archive
        version=$(echo "$tag" | tr -d 'v')
        git archive "v$version" -o "$repo-$version.tar.gz"
        hut git artifact upload --rev "$tag" "$repo-$version.tar.gz"
    - pypi-tag: |
        cd $repo
        tag=$(git describe --exact-match 2>/dev/null || true)
        if [ -z "$tag" ]; then
            echo "Current commit is not a tag; abort task"
            exit 0
        fi

        # Publish to PyPI
        set +x
        python3 -m build --sdist
        TWINE_USERNAME="__token__" \
        TWINE_PASSWORD="$(cat ~/.pypi_token)" \
        twine upload dist/*tar.gz
        set -x