-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (102 loc) · 3.18 KB
/
Copy pathrelease.yml
File metadata and controls
110 lines (102 loc) · 3.18 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
name: Release
# Cuts a release when a v* tag is pushed: builds the sdist + wheel, publishes to
# PyPI via Trusted Publishing (OIDC, no stored token), builds and pushes a
# multi-arch Docker image to GHCR, and creates a GitHub Release. Never runs on a
# normal push — only on a tag — so it is inert until v0.1.0 is tagged.
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write # create the GitHub Release
id-token: write # PyPI Trusted Publishing (OIDC)
packages: write # push to GHCR
jobs:
build:
name: Build sdist & wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- run: pip install build
- run: python -m build
- run: pip install dist/*.whl && python -c "import alleleforge; print(alleleforge.__version__)"
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*
sbom:
name: Software Bill of Materials (CycloneDX)
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
# Resolve the full runtime + optional dependency closure, then emit a
# CycloneDX SBOM over the installed environment so the release records the
# exact transitive supply chain it shipped with.
- run: pip install -e ".[core,genome,cli,web,ml]" cyclonedx-bom
- run: cyclonedx-py environment --output-format JSON --outfile alleleforge.cdx.json
- uses: actions/upload-artifact@v7
with:
name: sbom
path: alleleforge.cdx.json
pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
docker:
name: Multi-arch Docker image (GHCR)
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v6
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
github-release:
name: GitHub Release
needs: [build, sbom, pypi, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- uses: actions/download-artifact@v8
with:
name: sbom
path: dist
- uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
files: dist/*