-
Notifications
You must be signed in to change notification settings - Fork 61
106 lines (92 loc) · 2.77 KB
/
release.yml
File metadata and controls
106 lines (92 loc) · 2.77 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
name: Build & Release
on:
workflow_call:
inputs:
release-tag:
required: true
type: string
description: Tag to release
# TODO(CG-10758): create if it does not exist
# workflow_dispatch:
# inputs:
# tag:
# required: true
# type: string
# description: Tag to release
push:
tags:
- v*
pull_request:
branches:
- develop
permissions:
contents: read
jobs:
build:
name: Build Pure Python Wheel
runs-on: ubuntu-latest
steps:
- name: Github context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.release-tag || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
- name: Install UV
uses: astral-sh/setup-uv@v5.4
id: setup-uv
with:
enable-cache: true
prune-cache: false
python-version: "3.12" # Use single Python version for building
version: '0.5.24'
- name: Fetch tags
if: ${{ inputs.release-tag || startsWith(github.ref, 'refs/tags/') }}
run: |
git branch
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Build wheel
run: |
uv build --wheel --out-dir dist/
- uses: actions/upload-artifact@v4
with:
name: wheels
path: ./dist/*.whl
release:
if: ${{ inputs.release-tag || startsWith(github.ref, 'refs/tags/') }}
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
contents: write # grants permission to create a release on github
steps:
- uses: actions/checkout@v4
- name: Setup backend
uses: ./.github/actions/setup-environment
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
pattern: wheels
- name: Release PyPI
uses: ./.github/actions/release-pypi
with:
pypi-token: ${{ secrets.PYPI_TOKEN }}
- name: Github release
id: github-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.release-tag || github.ref_name }}
files: dist/*
fail_on_unmatched_files: true
generate_release_notes: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Slack notification
if: always()
uses: ./.github/actions/release-slack-bot
with:
release-tag: ${{ inputs.release-tag || github.ref_name }}
slack-token: ${{ secrets.SLACK_BOT_TOKEN }}