-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (131 loc) · 4.26 KB
/
release.yaml
File metadata and controls
148 lines (131 loc) · 4.26 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Release
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- {"runner": "ubuntu-latest", "platform_tag": "musllinux_1_2", "arch": "x86_64"}
- {"runner": "windows-latest", "platform_tag": "win", "arch": "amd64"}
- {"runner": "macos-latest", "platform_tag": "macosx_11_0", "arch": "arm64"}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install package in development mode
env:
CIBW_ARCHS: ${{ matrix.platform.arch }}
CIBW_PLATFORM: ${{ matrix.platform.platform_tag }}
run: |
uv venv
uv pip install -e .
- name: Run cross-platform tests
run: |
python tests/test_yamlfmt.py
release-build:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- {"runner": "ubuntu-latest", "platform_tag": "musllinux_1_2", "arch": "x86_64"}
- {"runner": "ubuntu-latest", "platform_tag": "musllinux_1_2", "arch": "i686"}
- {"runner": "ubuntu-latest", "platform_tag": "musllinux_1_2", "arch": "armv7l"}
- {"runner": "ubuntu-latest", "platform_tag": "musllinux_1_2", "arch": "aarch64"}
- {"runner": "ubuntu-latest", "platform_tag": "manylinux_2_17", "arch": "x86_64"}
- {"runner": "ubuntu-latest", "platform_tag": "manylinux_2_17", "arch": "aarch64"}
- {"runner": "windows-latest", "platform_tag": "win", "arch": "amd64"}
- {"runner": "windows-latest", "platform_tag": "win", "arch": "arm64"}
- {"runner": "macos-latest", "platform_tag": "macosx_10_12", "arch": "x86_64"}
- {"runner": "macos-latest", "platform_tag": "macosx_11_0", "arch": "arm64"}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: build release distributions
env:
CIBW_ARCHS: ${{ matrix.platform.arch }}
CIBW_PLATFORM: ${{ matrix.platform.platform_tag }}
run: |
uv build
- name: upload dists
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.platform_tag }}-${{ matrix.platform.arch }}
path: dist/*.whl
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: build release distributions
env:
CIBW_ARCHS: "x86_64"
CIBW_PLATFORM: "manylinux_2_17"
run: |
uv build
- name: upload dists
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist/google_yamlfmt-*.tar.gz
publish-pypi:
runs-on: ubuntu-latest
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
- release-build
- sdist
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist/
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Publish release distributions to PyPI
run: uv publish -v
publish-release:
runs-on: ubuntu-latest
name: Publish to GitHub
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
- release-build
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist/
- name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Publish to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
files: dist/*
tag_name: ${{ env.RELEASE_VERSION }}