File: release.yml

package info (click to toggle)
lexicon 3.21.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 72,688 kB
  • sloc: python: 20,075; sh: 94; makefile: 7
file content (89 lines) | stat: -rw-r--r-- 2,728 bytes parent folder | download
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
name: release

on:
  push:
    tags: ["v3.*"]

concurrency:
  group: release-${{ github.ref }}
  cancel-in-progress: false

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  main:
    uses: ./.github/workflows/main.yml
  pypi:
    runs-on: ubuntu-24.04
    needs: [main]
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Install uv
        uses: astral-sh/setup-uv@v6
      - name: Publish sdist & wheel to PyPI
        run: |
          uv build
          uv publish --username __token__ --password "${PYPI_TOKEN}"
        env:
          PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
  github:
    runs-on: ubuntu-24.04
    needs: [pypi]
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Get project version
        run: echo "VERSION=$(cat pyproject.toml | grep '^version = .*' | sed -E 's/version = "(.*)"/\1/g')" >> $GITHUB_ENV
      - name: Configure Python
        uses: actions/setup-python@v5
      - name: Prepare changelog
        run: python utils/extract_changelog.py ${VERSION} > release_${VERSION}.md
      - name: Publish Github release
        uses: softprops/action-gh-release@v2
        with:
          name: Lexicon v${{ env.VERSION }}
          body_path: release_${{ env.VERSION }}.md
  docker:
    runs-on: ubuntu-24.04
    needs: [pypi]
    permissions:
      contents: read
      packages: write
      attestations: write
      id-token: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Get project version
        run: echo "VERSION=$(cat pyproject.toml | grep '^version = .*' | sed -E 's/version = "(.*)"/\1/g')" >> $GITHUB_ENV
      - name: Log-in to the Container registry
        uses: docker/login-action@v3
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=semver,pattern={{version}}
      - name: Build & push Docker image
        id: push
        uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          build-args: VERSION=${{ env.VERSION }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
      - name: Generate artifact attestation
        uses: actions/attest-build-provenance@v2
        with:
          subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
          subject-digest: ${{ steps.push.outputs.digest }}
          push-to-registry: true