-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (86 loc) · 3.17 KB
/
deploy_build_artifact.yaml
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
name: build artifact
on:
workflow_dispatch:
workflow_call:
outputs:
artifact-url:
description: "URL to the uploaded artifact"
value: ${{ jobs.build_artifacts.outputs.artifact-url }}
artifact-id:
description: "ID of the uploaded artifact"
value: ${{ jobs.build_artifacts.outputs.artifact-id }}
package-version:
description: "Version of the package"
value: ${{ jobs.build_artifacts.outputs.package-version }}
artifact-name:
description: "Name of the artifact"
value: ${{ jobs.build_artifacts.outputs.artifact-name }}
jobs:
build_artifacts:
runs-on: ubuntu-latest
permissions: # Job-level permissions configuration starts here
contents: write # 'write' access to repository contents
actions: read
id-token: write
attestations: write
steps:
- name: Set up Python
uses: actions/setup-python@v5 # v5
with:
python-version: 3.12
- name: install poetry
uses: snok/install-poetry@v1 # v1
with:
# use latest poetry version
# version: 1.8.3 # pin the version as they keep changing their APIs
virtualenvs-create: false
virtualenvs-in-project: false
- name: check out code
uses: actions/checkout@v4 # v4
with:
fetch-depth: 1
- name: Install dependencies
run: |
python -m venv venv
. venv/bin/activate
poetry install --with dev --no-interaction --sync
python -c "import os; print(os.environ['VIRTUAL_ENV'])"
- name: Build
id: Build
run: |
version=$(poetry version | awk '{print $2}')
echo "version is $version"
echo "version=$version" >> "$GITHUB_OUTPUT"
artifact_name="dist-$version"
echo "artifact_name is $artifact_name"
echo "artifact_name=$artifact_name" >> "$GITHUB_OUTPUT"
poetry build
- name: attest artifacts
id: attest-artifacts
uses: actions/attest-build-provenance@v1
with:
subject-path: 'dist/*'
# dont do this yet - PEP 740 support just isnt ready
# - name: copy attestation to dist dir
# run: |
# cp ${{ steps.attest-artifacts.outputs.bundle-path }} $GITHUB_WORKSPACE/dist/attestation.jsonl
- name: Upload build artifact
id: upload-artifact
uses: actions/upload-artifact@v4 # v4
with:
compression-level: 0 # no compression
if-no-files-found: error
name: ${{ steps.Build.outputs.artifact_name }}
path: dist/*
- name: publish release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*,${{ steps.attest-artifacts.outputs.bundle-path }}"
tag: ${{ steps.Build.outputs.version }}
allowUpdates: true
artifactErrorsFailBuild: true
outputs:
artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }}
artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }}
package-version: ${{ steps.Build.outputs.version }}
artifact-name: ${{ steps.Build.outputs.artifact_name }}