1- name : CI
1+ name : Release and Publish
22
33on :
44 push :
55 branches : [main]
6- pull_request :
7- branches : [main]
86
97permissions :
108 contents : read
1311 # Validate the squash merge commit message on pushes to main.
1412 # PR title validation is handled separately in pr-title.yml.
1513 commitlint :
16- if : github.event_name == 'push'
1714 runs-on : ubuntu-latest
1815 steps :
1916 - name : Checkout
@@ -34,60 +31,18 @@ jobs:
3431 - name : Validate commit message
3532 run : uv run cz check --rev-range HEAD~1..HEAD
3633
37- lint :
38- runs-on : ubuntu-latest
39- strategy :
40- matrix :
41- python-version : ["3.11"] # TODO see https://github.com/mitre-attack/mitreattack-python/issues/176
42- steps :
43- - uses : actions/checkout@v6
44-
45- - name : Install the latest version of uv
46- uses : astral-sh/setup-uv@v7
47- with :
48- python-version : ${{ matrix.python-version }}
49-
50- - name : Install dependencies
51- run : uv sync --all-extras
52-
53- - name : Lint with ruff
54- run : uv run ruff check --output-format github
55-
56- - name : Check formatting with ruff
57- run : uv run ruff format --check
58-
59- test :
60- runs-on : ubuntu-latest
61- strategy :
62- matrix :
63- python-version : ["3.11"] # TODO see https://github.com/mitre-attack/mitreattack-python/issues/176
64- steps :
65- - uses : actions/checkout@v6
66-
67- - name : Install the latest version of uv
68- uses : astral-sh/setup-uv@v7
69- with :
70- python-version : ${{ matrix.python-version }}
71-
72- - name : Install dependencies
73- run : uv sync --all-extras
74-
75- # - name: Run pytest
76- # run: uv run pytest --cov=mitreattack
77-
7834 release :
79- needs : [commitlint, lint, test]
80- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
35+ needs : [commitlint]
8136 strategy :
8237 matrix :
8338 python-version : ["3.11"] # TODO see https://github.com/mitre-attack/mitreattack-python/issues/176
8439 runs-on : ubuntu-latest
8540 # The concurrency block prevents multiple release jobs from running simultaneously for the same branch.
86- # This is particularly useful for releases since you typically want sequential deployments (finish
87- # current release before starting next) rather than canceling in-progress releases or running them
41+ # This is particularly useful for releases since you typically want sequential deployments (finish
42+ # current release before starting next) rather than canceling in-progress releases or running them
8843 # in parallel.
8944 concurrency :
90- # Creates a concurrency group keyed by workflow name + "release" + branch name (e.g., "Continuous Delivery -release-main")
45+ # Creates a concurrency group keyed by workflow name + "release" + branch name (e.g., "Release and Publish -release-main")
9146 group : ${{ github.workflow }}-release-${{ github.ref_name }}
9247 # If a release is already running and a new push triggers another, the new job waits rather than canceling the running one
9348 # If you changed cancel-in-progress to true, a new push would cancel the currently running release job.
@@ -159,11 +114,12 @@ jobs:
159114 needs : release
160115 if : needs.release.outputs.released == 'true'
161116 runs-on : ubuntu-latest
162- environment : release
163-
117+ environment :
118+ name : release
119+ url : https://pypi.org/p/mitreattack-python
164120 permissions :
165121 contents : read
166- id-token : write
122+ id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
167123
168124 steps :
169125 - name : Download build artifacts
0 commit comments