-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (99 loc) · 2.82 KB
/
release.yml
File metadata and controls
115 lines (99 loc) · 2.82 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
name: release
on:
push:
tags:
- "v*"
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build artifacts
run: python -m build
- name: Smoke-test built wheel
run: |
set -euo pipefail
wheel=(dist/*.whl)
if [ "${#wheel[@]}" -ne 1 ]; then
echo "Expected exactly one wheel artifact in dist/" >&2
exit 1
fi
python -m venv /tmp/azurefox-release-smoke-venv
/tmp/azurefox-release-smoke-venv/bin/pip install "${wheel[0]}"
/tmp/azurefox-release-smoke-venv/bin/azurefox help >/dev/null
AZUREFOX_FIXTURE_DIR=tests/fixtures/lab_tenant \
/tmp/azurefox-release-smoke-venv/bin/azurefox \
--outdir /tmp/azurefox-release-smoke \
--output json \
whoami \
>/dev/null
- name: Upload release artifacts
uses: actions/upload-artifact@v7
with:
name: release-dist
path: dist/*
if-no-files-found: error
github-release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download release artifacts
uses: actions/download-artifact@v8
with:
name: release-dist
path: dist
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
assets=(dist/*)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release assets found in dist/" >&2
exit 1
fi
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release upload "${GITHUB_REF_NAME}" "${assets[@]}" --clobber
else
gh release create "${GITHUB_REF_NAME}" "${assets[@]}" \
--generate-notes \
--title "${GITHUB_REF_NAME}" \
--verify-tag
fi
pypi-publish:
runs-on: ubuntu-latest
needs: build
environment:
name: pypi
permissions:
id-token: write
steps:
- name: Download release artifacts
uses: actions/download-artifact@v8
with:
name: release-dist
path: dist
- name: Publish to PyPI via Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/