-
Notifications
You must be signed in to change notification settings - Fork 20
130 lines (130 loc) · 4.37 KB
/
Copy pathpyproject_fmt_build.yaml
File metadata and controls
130 lines (130 loc) · 4.37 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: 📦 pyproject-fmt
on:
workflow_dispatch:
inputs:
release:
description: "🚀 Release (semver bump)?"
required: true
default: "no"
type: choice
options: ["no", patch, minor, major]
push:
branches: ["main"]
paths:
- "toml-doc/**"
- "common/**"
- "toml-fmt-common/**"
- "tox-rules/**"
- "pyproject-fmt/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".github/workflows/pyproject_fmt_build.yaml"
- ".github/workflows/_build.yaml"
pull_request:
schedule:
- cron: "0 8 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}${{ github.event.inputs.release && github.event.inputs.release != 'no' && '-release' || '' }}
cancel-in-progress: ${{ github.event.inputs.release == 'no' || github.event.inputs.release == null }}
jobs:
changes:
name: 🔍 changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }}
steps:
- name: 📥 Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: 🔍 Check for changes
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
run:
- 'toml-doc/**'
- 'common/**'
- 'toml-fmt-common/**'
- 'tox-rules/**'
- 'pyproject-fmt/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/pyproject_fmt_build.yaml'
- '.github/workflows/_build.yaml'
build:
needs: changes
uses: $/.github/workflows/_build.yaml
with:
package-name: pyproject-fmt
pre-commit-mirror: tox-dev/pyproject-fmt
run: ${{ needs.changes.outputs.run }}
secrets: inherit # zizmor: ignore[secrets-inherit]
permissions:
contents: write
id-token: write
pull-requests: read
release:
name: 🚀 release
runs-on: ubuntu-24.04
environment:
name: release
url: https://pypi.org/project/pyproject-fmt/${{ needs.build.outputs.version }}
permissions:
id-token: write
contents: write
if: github.event.inputs.release != 'no' && github.event.inputs.release != null && github.ref == 'refs/heads/main'
needs: [build]
steps:
- name: 📥 Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ secrets.RELEASE_TOKEN }}
persist-credentials: true
- name: 📥 Download source
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: source
path: .
- name: 👀 Show changes
run: git diff HEAD -u
- name: 💾 Commit release
run: |
git config --global user.name 'Bernat Gabor'
git config --global user.email 'gaborbernat@users.noreply.github.com'
git commit -am "Release pyproject-fmt ${VERSION} [skip ci]"
env:
VERSION: ${{ needs.build.outputs.version }}
- name: 📥 Download wheels
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
pattern: wheels-*
path: dist
merge-multiple: "true"
- name: 👀 Show wheels
run: ls -lth dist
- name: 🚀 Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
skip-existing: true
- name: 📢 Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
VERSION: ${{ needs.build.outputs.version }}
CHANGELOG: ${{ needs.build.outputs.changelog }}
run: |
git pull --rebase origin main
git tag "pyproject-fmt/${VERSION}"
git push
git push --tags
gh release create "pyproject-fmt/${VERSION}" \
--title="pyproject-fmt/${VERSION}" --verify-tag \
--notes "${CHANGELOG}"
- name: 🔄 Trigger pre-commit mirror sync
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: gh workflow run main.yaml --repo "tox-dev/pyproject-fmt"