forked from sequence-toolbox/SeQUeNCe
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (89 loc) · 3.03 KB
/
Copy pathdevelopment.yml
File metadata and controls
108 lines (89 loc) · 3.03 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
name: RnD Build Pipeline
on:
push:
branches: [RnD]
workflow_dispatch:
env:
PROD_PYPI_NAME: 'sequence'
TEST_PYPI_NAME: 'ssequence'
jobs:
build-rnd:
if: github.repository == 'sequence-toolbox/SeQUeNCe'
name: Build RnD Package
runs-on: ubuntu-latest
outputs:
dev_version: ${{ steps.version.outputs.dev_version }}
commit_hash: ${{ steps.version.outputs.commit_hash }}
strategy:
matrix:
target: [pypi, testpypi]
steps:
- name: Checkout RnD branch
uses: actions/checkout@v6
with:
persist-credentials: true
ref: RnD
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Generate development version
id: version
run: |
GIT_HASH=$(git rev-parse --short HEAD)
NUMERIC_HASH=$((0x${GIT_HASH}))
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
DEV_VERSION="${CURRENT_VERSION}.dev${NUMERIC_HASH}"
echo "dev_version=${DEV_VERSION}" >> $GITHUB_OUTPUT
echo "commit_hash=${GIT_HASH}" >> $GITHUB_OUTPUT
echo "DEV_VERSION=${DEV_VERSION}" >> $GITHUB_ENV
echo "Building development version from RnD: ${DEV_VERSION}"
- name: Update package configuration
run: |
# Update version in pyproject.toml
sed -i "s/^version = .*/version = \"${DEV_VERSION}\"/" pyproject.toml
if [ "${{ matrix.target }}" = "testpypi" ]; then
sed -i "s/^name = \"sequence\"/name = \"ssequence\"/" pyproject.toml
fi
- name: Build wheel and tarball
run: uv build
- name: Store build as an artifact
uses: actions/upload-artifact@v4
with:
name: build-RnD-${{ matrix.target }}-${{ steps.version.outputs.dev_version }}
path: dist/
retention-days: 4
publish-rnd:
name: Publish RnD to TestPyPI and PyPI
needs: build-rnd
runs-on: ubuntu-latest
if: success() && github.repository == 'sequence-toolbox/SeQUeNCe'
strategy:
matrix:
include:
- target: pypi
environment: pypi
repository_url: https://pypi.org/p/sequence
package_name: sequence
- target: testpypi
environment: testpypi
repository_url: https://test.pypi.org/p/ssequence
package_name: ssequence
pypi_url: https://test.pypi.org/legacy/
environment:
name: ${{ matrix.environment }}
url: ${{ matrix.repository_url }}
permissions:
id-token: write
attestations: write
steps:
- name: Download the builds
uses: actions/download-artifact@v4
with:
name: build-RnD-${{ matrix.target }}-${{ needs.build-rnd.outputs.dev_version }}
path: dist/
- name: Publish dist
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
repository-url: ${{ matrix.pypi_url || '' }}
skip-existing: true
verbose: true