Skip to content

Commit 7d597f4

Browse files
committed
ci: update deploy workflow to not use old workspace repo
1 parent 741672b commit 7d597f4

2 files changed

Lines changed: 40 additions & 29 deletions

File tree

.github/buildlib

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ if [[ -n ${SOURCE_CARGO_C} ]]; then
6262
cargo install cargo-c
6363
fi
6464

65-
# update cargo lock file using dep versions from tagged releases
66-
doecho cargo update
65+
# clone the pkgcraft repo from a specific tag or branch
66+
git clone -b ${PKGCRAFT_C_REF:-main} --recurse-submodules https://github.com/pkgcraft/pkgcraft.git
67+
6768
# build and install C library
68-
doecho cargo cinstall -p pkgcraft-c --profile bundled
69+
doecho cargo cinstall --manifest-path pkgcraft/Cargo.toml -p pkgcraft-c --profile bundled

.github/workflows/deploy.yml

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,36 @@ on:
44
push:
55
branches: [deploy]
66
tags: [v*]
7+
workflow_dispatch:
8+
inputs:
9+
pkgcraft-c-ref:
10+
required: false
11+
type: string
12+
default: 'main'
713

814
jobs:
15+
setup:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
pkgcraft-c-ref: ${{ steps.vars.outputs.pkgcraft-c-ref }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Determine target pkgcraft-c version
24+
id: vars
25+
run: |
26+
if [[ -n "${{ inputs.pkgcraft-c-ref }}" ]]; then
27+
echo "pkgcraft-c-ref=${{ inputs.pkgcraft-c-ref }}" >> $GITHUB_OUTPUT
28+
else
29+
max_ver=$(sed -rn '/^MAX_VERSION =/s/^.*=\s*"([0-9](\.[0-9])*)(.*)/\1/p' setup.py)
30+
if [[ -n ${max_ver} ]]; then
31+
echo "pkgcraft-c-ref=pkgcraft-c-${max_ver}" >> $GITHUB_OUTPUT
32+
else
33+
exit 1
34+
fi
35+
fi
36+
937
build-sdist:
1038
runs-on: ubuntu-latest
1139
steps:
@@ -19,7 +47,7 @@ jobs:
1947
- name: Set up Python
2048
uses: actions/setup-python@v4
2149
with:
22-
python-version: '3.10'
50+
python-version: '3.x'
2351

2452
- name: Build sdist
2553
run: |
@@ -35,7 +63,7 @@ jobs:
3563
retention-days: 3
3664

3765
build-wheels:
38-
needs: ["build-sdist"]
66+
needs: ["build-sdist", "setup"]
3967
strategy:
4068
matrix:
4169
include:
@@ -50,42 +78,24 @@ jobs:
5078
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }}
5179
CIBW_CONTAINER_ENGINE: 'docker'
5280
CIBW_PLATFORM: 'auto'
81+
PKGCRAFT_C_REF: ${{ needs.setup.outputs.pkgcraft-c-ref }}
5382

5483
steps:
55-
- name: Checkout workspace
56-
uses: actions/checkout@v3
57-
with:
58-
repository: pkgcraft/pkgcraft-workspace
59-
submodules: recursive
60-
# checkout full history to support tagged releases
61-
fetch-depth: 0
62-
63-
- name: Pull submodule updates and checkout the latest tags if they exist
64-
run: |
65-
git submodule update --recursive --remote
66-
git submodule foreach 'git fetch origin; git checkout $(git describe --tags `git rev-list --tags --max-count=1`);'
67-
68-
- name: Remove current repo from workspace
69-
run: rm -rfv ${{ github.event.repository.name }}
70-
7184
- name: Checkout code
7285
uses: actions/checkout@v3
7386
with:
74-
# checkout full history for setuptools-scm
75-
fetch-depth: 0
76-
path: ${{ github.event.repository.name }}
7787
submodules: recursive
7888

7989
- name: Download sdist artifact
8090
uses: actions/download-artifact@v3
8191
with:
8292
name: sdist
83-
path: pkgcraft-python/dist
93+
path: dist
8494

8595
- name: Set up Python
8696
uses: actions/setup-python@v4
8797
with:
88-
python-version: '3.10'
98+
python-version: '3.x'
8999

90100
- name: Set up QEMU
91101
if: runner.os == 'Linux' && matrix.arch != 'x86_64'
@@ -94,18 +104,18 @@ jobs:
94104
platforms: ${{ matrix.arch }}
95105

96106
- name: Build wheels
97-
run: ./build-wheels ${{ matrix.arch }}
107+
run: .github/build-wheels ${{ matrix.arch }}
98108

99109
- name: Verify wheels
100110
run: |
101111
pip install twine
102-
twine check pkgcraft-python/wheels/*
112+
twine check wheels/*
103113
104114
- name: Upload build artifacts
105115
uses: actions/upload-artifact@v3
106116
with:
107117
name: wheels
108-
path: pkgcraft-python/wheels/
118+
path: wheels/
109119
if-no-files-found: error
110120
retention-days: 3
111121

0 commit comments

Comments
 (0)