File: deploy.yml

package info (click to toggle)
pytest-mock 3.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 348 kB
  • sloc: python: 1,562; makefile: 19
file content (76 lines) | stat: -rw-r--r-- 1,883 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
name: deploy

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Release version'
        required: true
        default: '1.2.3'

jobs:

  package:
    runs-on: ubuntu-latest
    # Required by attest-build-provenance-github.
    permissions:
      id-token: write
      attestations: write
    env:
      SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}

    steps:
    - uses: actions/checkout@v5

    - name: Build and Check Package
      uses: hynek/build-and-inspect-python-package@v2.13.0
      with:
        attest-build-provenance-github: 'true'


  deploy:
    needs: package
    runs-on: ubuntu-latest
    environment: deploy
    permissions:
      id-token: write  # For PyPI trusted publishers.
      contents: write  # For tag and release notes.

    steps:
    - uses: actions/checkout@v5

    - name: Download Package
      uses: actions/download-artifact@v5
      with:
        name: Packages
        path: dist

    - name: Publish package to PyPI
      uses: pypa/gh-action-pypi-publish@v1.13.0
      with:
        attestations: true

    - name: Push tag
      run: |
        git config user.name "pytest bot"
        git config user.email "pytestbot@gmail.com"
        git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
        git push origin v${{ github.event.inputs.version }}

    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: "3.10"

    - name: Generate release notes
      run: |
        pip install pypandoc
        sudo apt-get install pandoc
        python scripts/gen-release-notes.py

    - name: GitHub Release
      uses: softprops/action-gh-release@v2
      with:
        body_path: scripts/latest-release-notes.md
        files: dist/*
        tag_name: v${{ github.event.inputs.version }}