-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (76 loc) · 2.59 KB
/
Copy pathdeploy.yml
File metadata and controls
90 lines (76 loc) · 2.59 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
name: Publish src_method Python sdist and wheels to Algorithmiq PyPI
on:
workflow_dispatch:
inputs:
force-upload:
description: 'Upload artifacts without a corresponding release'
required: false
default: false
type: boolean
release:
types:
- published
pull_request:
# PRs trigger for the "opened", "reopened", "synchronize" events (default) and
# "ready_for_review"
paths:
- .github/workflows/deploy.yml
types:
- opened
- reopened
- synchronize
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
COLUMNS: 120
FORCE_COLOR: 3
jobs:
build-sdist-wheel:
name: Build source distribution and wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # such that setuptools_scm can do its job correctly
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Build SDist and Wheel
run: |
# the `build` package's console script is `pyproject-build`, not `build`
uvx --from build pyproject-build --verbose --sdist --wheel --installer=uv
- uses: actions/upload-artifact@v7
with:
name: cibw-dist
path: |
dist/*.tar.gz
dist/*.whl
upload_codeartifact:
name: Upload to AWS CodeArtifact
needs:
- build-sdist-wheel
if: (github.event_name == 'release' && github.event.action == 'published') || github.event.inputs.force-upload
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/download-artifact@v8
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::406960181794:role/github-actions-codeartifact-write-access
aws-region: eu-west-1
- name: Publish
run: |
export TWINE_USERNAME=aws
export TWINE_PASSWORD="$(aws codeartifact get-authorization-token --domain algorithmiq --domain-owner 406960181794 --region eu-west-1 --query authorizationToken --output text)"
export TWINE_REPOSITORY_URL="$(aws codeartifact get-repository-endpoint --domain algorithmiq --domain-owner 406960181794 --repository pypi --region eu-west-1 --format pypi --query repositoryEndpoint --output text)"
pipx run twine upload dist/*