File: release.yaml

package info (click to toggle)
pyee 13.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 296 kB
  • sloc: python: 1,113; makefile: 4; sh: 1
file content (109 lines) | stat: -rw-r--r-- 3,648 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Release
on:
  push:
    tags:
      - 'v*'
jobs:
  versions:
    runs-on: ubuntu-latest
    outputs:
      python-version: ${{ steps.python-version.outputs.python_version }}
      release-version: ${{ steps.release-version.outputs.release_version }}
    steps:
      - uses: actions/checkout@v4
      - name: Get latest supported Python version
        id: python-version
        run: |
          CLASSIFIERS="$(yq -p toml -o toml '.project.classifiers[]' pyproject.toml | grep "Programming Language :: Python :: " | grep "\.")"
          VERSION="$(echo "${CLASSIFIERS}" | sed -e 's/Programming Language :: Python :: \([0-9.]*\)$/\1/g' | tail -n 1)"
          echo "python_version=${VERSION}" > "${GITHUB_OUTPUT}"
      # See: https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
      - name: Get release version
        id: release-version
        run: |
          VERSION="$(yq -p toml -o toml -r '.project.version' pyproject.toml)"
          echo "release_version=${VERSION}" >> "${GITHUB_OUTPUT}"

  build:
    runs-on: ubuntu-latest
    needs:
      - versions
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ needs.versions.outputs.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: "${{ needs.versions.outputs.python-version }}"
      - name: Install the world
        run: |
          python -m pip install --upgrade pip setuptools wheel
          pip install -e .[dev]
      - name: Build Package Distributions
        run: python -m build
      - name: Store Package Distributions
        uses: actions/upload-artifact@v4
        with:
          name: package-distributions
          path: dist/
      - name: Build Man Page
        run: sphinx-build -M man docs _build
      - name: Store Man Page
        uses: actions/upload-artifact@v4
        with:
          name: man-page
          path: _build/man
      - name: Build Release Notes
        # thanks to https://gist.github.com/Integralist/57accaf446cf3e7974cd01d57158532c
        run: mkdir notes && awk '/^##/ {block++} {if (block == 1) { print }}' CHANGELOG.md > notes/RELEASE.md
      - name: Store Release Notes
        uses: actions/upload-artifact@v4
        with:
          name: release-notes
          path: notes

  pypi-release:
    runs-on: ubuntu-latest
    needs:
      - build
    environment:
      name: pypi
      url: https://pypi.org/p/pypi
    permissions:
      id-token: write
    steps:
      - name: Download distributions
        uses: actions/download-artifact@v4.1.7
        with:
          name: package-distributions
          path: dist/
      - name: Publish release to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1

  github-release:
    runs-on: ubuntu-latest
    needs:
      - versions
      - build
    steps:
      - uses: actions/checkout@v4
      - name: Download distributions
        uses: actions/download-artifact@v4.1.7
        with:
          name: package-distributions
          path: dist/
      - name: Download man page
        uses: actions/download-artifact@v4.1.7
        with:
          name: man-page
          path: man
      - name: Download release notes
        uses: actions/download-artifact@v4.1.7
        with:
          name: release-notes
          path: notes
      - name: Create a GitHub release
        env:
          GITHUB_TOKEN: ${{ github.TOKEN }}
        shell: bash
        run: |
          gh release create 'v${{ needs.versions.outputs.release-version }}' --title 'Release v${{ needs.versions.outputs.release-version }}' --notes "$(cat notes/RELEASE.md)" dist/* man/pyee.1