File: deploy.yml

package info (click to toggle)
requirements-parser 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 568 kB
  • sloc: python: 360; makefile: 146
file content (97 lines) | stat: -rw-r--r-- 3,384 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
90
91
92
93
94
95
96
97
name: Release

on:
  push:
    branches:
      - main
  workflow_dispatch:
    inputs:
      release_force:
        # see https://python-semantic-release.readthedocs.io/en/latest/github-action.html#command-line-options
        description: |
          Force release be one of: [major | minor | patch]
          Leave empty for auto-detect based on commit messages.
        type: choice
        options:
          - "" # auto - no force
          - major # force major
          - minor # force minor
          - patch # force patch
        default: ""
        required: false
      prerelease_token:
        description: 'The "pre-release identifier" to use as a prefix for the "pre-release" part of a semver. Like the rc in `1.2.0-rc.8`.'
        type: choice
        options:
          - rc
          - beta
          - alpha
        default: rc
        required: false
      prerelease:
        description: "Is a pre-release"
        type: boolean
        default: false
        required: false

concurrency:
  group: deploy
  cancel-in-progress: false  # prevent duplicates semantic-release

env:
  PYTHON_VERSION_DEFAULT: "3.13"
  POETRY_VERSION: "1.8.1"

permissions:
    id-token: write
    contents: write

jobs:
  build-and-release:
    # https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
    # limit this to being run on regular commits, not the commits that semantic-release will create
    if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
    runs-on: ubuntu-latest
    concurrency: release
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Python Environment
        # see https://github.com/actions/setup-python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
          architecture: 'x64'
      - name: Install poetry
        # see https://github.com/marketplace/actions/setup-poetry
        uses: Gr1N/setup-poetry@v9
        with:
          poetry-version: ${{ env.POETRY_VERSION }}
      - name: Install dependencies
        run: poetry install --no-root

      - name: Python Semantic Release
        id: release
        # see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
        # see https://github.com/python-semantic-release/python-semantic-release
        uses: python-semantic-release/python-semantic-release@v9.1.1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          force: ${{ github.event.inputs.release_force }}
          prerelease: ${{ github.event.inputs.prerelease }}
          prerelease_token: ${{ github.event.inputs.prerelease_token }}

      - name: Publish package distributions to PyPI
        if: steps.release.outputs.released == 'true'
        # see https://github.com/pypa/gh-action-pypi-publish
        uses: pypa/gh-action-pypi-publish@release/v1

      - name: Publish package distributions to GitHub Releases
        if: steps.release.outputs.released == 'true'
        # see https://github.com/python-semantic-release/upload-to-gh-release
        uses: python-semantic-release/upload-to-gh-release@main
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ steps.release.outputs.tag }}