Skip to content

Commit 4f09cdb

Browse files
authored
feat: Add codecov-cli gh release publish to craft flow (#83)
Doing these separately caused issues as craft was deleting the branch/references to the codecov cli assets. This pr makes the codecov-cli assets upload with the prevent assets through the craft flow. Also adds a script to change the editable field on the codecov-cli dependency in prevent-cli, which is necessary for the pyinstaller build to work.
1 parent 74fc2bc commit 4f09cdb

6 files changed

Lines changed: 28 additions & 36 deletions

File tree

.craft.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ targets:
1010
tagPrefix: v
1111
checksums:
1212
- algorithm: sha256
13-
includeNames: /^sentry-prevent-cli_.*/i
13+
includeNames: /^(sentry-prevent-|sentry_prevent_|codecov|codecov_)cli.*/i
1414

1515
# - name: pypi

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ jobs:
9494
cd ../codecov-cli
9595
uv sync --no-binary-package pyyaml --no-binary-package ijson
9696
97+
- name: Run pre-build script
98+
run: ./scripts/pre-build.sh
99+
97100
- name: Build with pyinstaller for ${{matrix.TARGET}}
98101
run: ${{matrix.CMD_BUILD}}
99102

@@ -158,18 +161,22 @@ jobs:
158161
path: ./prevent-cli/dist/sentry-prevent-cli_*
159162

160163
package_artifacts:
161-
# Craft requires one artifact named after the long commit sha of the release
164+
# Craft requires one artifact named after the long commit sha of the release.
162165
name: Package assets for Craft
163166
runs-on: ubuntu-latest
164167
needs: [build_for_pypi, build_assets, build_linux_assets]
165168
steps:
166169
- name: Download artifacts
167170
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
168171
with:
169-
pattern: sentry-prevent-cli_*
172+
pattern: "{sentry-prevent-,codecov-,codecov}cli*"
170173

171174
- name: Upload release artifact
172175
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
173176
with:
174177
name: ${{ github.sha }}
175-
path: sentry-prevent-cli_*
178+
path: |
179+
sentry-prevent-cli*
180+
sentry-prevent-cli_wheel/*
181+
codecovcli*
182+
codecov-cli_wheel/*

.github/workflows/release-codecov-cli.yml

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# This workflow publishes the codecov-cli assets to PyPI, GitHub releases, and
2-
# our GCS bucket when a release is created.
1+
# This workflow publishes the codecov-cli assets to PyPI and our GCS bucket
2+
# when a release is created.
33
name: Build and publish codecov-cli
44

55
on:
@@ -10,8 +10,12 @@ permissions:
1010
contents: read
1111

1212
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- run: echo "hi from build and publish codecov-cli"
17+
1318
# publish_to_pypi:
14-
# needs: build_for_pypi
1519
# permissions:
1620
# id-token: write # This is required for OIDC
1721
# runs-on: ubuntu-latest
@@ -32,37 +36,8 @@ jobs:
3236
# verbose: true
3337
# packages-dir: codecov-cli/dist
3438

35-
publish_to_github:
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: Download build artifacts
39-
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
40-
with:
41-
branch: release/${{ github.ref }}
42-
name: codecov.*
43-
name_is_regexp: true
44-
path: codecov-cli/dist
45-
46-
- name: Get auth token
47-
id: token
48-
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
49-
with:
50-
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
51-
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
52-
53-
- name: Upload Release Asset
54-
id: upload-release-asset
55-
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # v2.11.2
56-
with:
57-
repo_token: ${{ steps.token.outputs.token }}
58-
file_glob: true
59-
file: ./codecov-cli/dist/*
60-
tag: ${{ github.ref }}
61-
overwrite: true
62-
6339
# publish_release:
6440
# name: Publish release
65-
# needs: [build_assets, build_linux_assets, build_for_pypi, publish_to_pypi]
6641
# runs-on: ubuntu-latest
6742
# permissions:
6843
# contents: "read"

scripts/build_alpine.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ if sha256sum -c ./scripts/uv-installer-0.7.8.sha256sum; then
77
sh uv-installer.sh; else
88
echo "uv-installer failed checksum" && exit 1
99
fi
10+
./scripts/pre-build.sh
1011
cd prevent-cli
1112
/root/.local/bin/uv python pin 3.9 # we need to build with python 3.9 to support systems with libpython >= 3.9
1213
/root/.local/bin/uv sync

scripts/build_linux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -eux
33
apt update
44
DEBIAN_FRONTEND=noninteractive apt install -y tzdata
55
apt install -y python3.9 python3.9-dev python3-pip
6+
./scripts/pre-build.sh
67
cd prevent-cli
78
python3.9 -m pip install uv --only-binary uv
89
uv python pin 3.9 # we need to build with python 3.9 to support systems with libpython >= 3.9

scripts/pre-build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# this updates the editable property on the codecov-cli import in prevent-cli
3+
# to be false. This is necessary for the pyinstaller build to work.
4+
if [[ "$OSTYPE" == "darwin"* ]]; then
5+
sed -i '' "s/editable\ =\ true/editable\ =\ false/g" prevent-cli/pyproject.toml
6+
else
7+
sed -i "s/editable\ =\ true/editable\ =\ false/g" prevent-cli/pyproject.toml
8+
fi

0 commit comments

Comments
 (0)