Skip to content

Commit 456a3df

Browse files
committed
Update build_assets to use release bot auth
1 parent b0e2965 commit 456a3df

5 files changed

Lines changed: 56 additions & 3 deletions

File tree

.github/workflows/build_assets.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
lipo -archs dist/codecovcli_macos | grep 'x86_64 arm64'
3232
OUT_FILE_NAME: codecovcli_macos
3333
ASSET_MIME: application/octet-stream
34+
3435
- os: ubuntu-22.04
3536
TARGET: ubuntu
3637
CMD_REQS: >
@@ -41,6 +42,7 @@ jobs:
4142
cp ./dist/main ./dist/codecovcli_linux
4243
OUT_FILE_NAME: codecovcli_linux
4344
ASSET_MIME: application/octet-stream
45+
4446
- os: windows-latest
4547
TARGET: windows
4648
CMD_REQS: >
@@ -50,35 +52,50 @@ jobs:
5052
Copy-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe"
5153
OUT_FILE_NAME: codecovcli_windows.exe
5254
ASSET_MIME: application/vnd.microsoft.portable-executable
55+
5356
steps:
5457
- uses: actions/checkout@v4
5558
with:
5659
submodules: true
60+
5761
- name: Set up Python 3.11
5862
uses: actions/setup-python@v3
5963
with:
6064
python-version: "3.11"
65+
6166
- name: Install dependencies
6267
run: |
6368
cd codecov-cli
6469
${{matrix.CMD_REQS}}
6570
python setup.py build
71+
6672
- name: Install pyinstaller
6773
run: pip install pyinstaller
74+
6875
- name: Build with pyinstaller for ${{matrix.TARGET}}
6976
run: cd codecov-cli && ${{matrix.CMD_BUILD}}
77+
7078
- name: Upload a Build Artifact
7179
uses: actions/upload-artifact@v4
7280
if: inputs.release == false
7381
with:
7482
name: ${{ matrix.OUT_FILE_NAME }}
7583
path: ./codecov-cli/dist/${{ matrix.OUT_FILE_NAME }}
84+
85+
- name: Get auth token
86+
if: inputs.release == true
87+
id: token
88+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
89+
with:
90+
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
91+
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
92+
7693
- name: Upload Release Asset
7794
if: inputs.release == true
7895
id: upload-release-asset
7996
uses: svenstaro/upload-release-action@v2
8097
with:
81-
repo_token: ${{ secrets.GITHUB_TOKEN }}
98+
repo_token: ${{ steps.token.outputs.token }}
8299
file: ./codecov-cli/dist/${{ matrix.OUT_FILE_NAME }}
83100
asset_name: ${{ matrix.OUT_FILE_NAME }}
84101
tag: ${{ github.ref }}
@@ -104,10 +121,12 @@ jobs:
104121
- uses: actions/checkout@v4
105122
with:
106123
submodules: true
124+
107125
- name: Set up QEMU
108126
uses: docker/setup-qemu-action@v1
109127
with:
110128
platforms: ${{ matrix.arch }}
129+
111130
- name: Run in Docker
112131
run: |
113132
docker run \
@@ -117,18 +136,28 @@ jobs:
117136
--platform linux/${{ matrix.arch }} \
118137
${{ matrix.distro }} \
119138
./codecov-cli/scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }}
139+
120140
- name: Upload a Build Artifact
121141
uses: actions/upload-artifact@v4
122142
if: inputs.release == false
123143
with:
124144
name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
125145
path: ./codecov-cli/dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
146+
147+
- name: Get auth token
148+
if: inputs.release == true
149+
id: token
150+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
151+
with:
152+
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
153+
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
154+
126155
- name: Upload Release Asset
127156
if: inputs.release == true
128157
id: upload-release-asset
129158
uses: svenstaro/upload-release-action@v2
130159
with:
131-
repo_token: ${{ secrets.GITHUB_TOKEN }}
160+
repo_token: ${{ steps.token.outputs.token }}
132161
file: ./codecov-cli/dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
133162
asset_name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
134163
tag: ${{ github.ref }}

.github/workflows/build_for_pypi.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@ on:
1010
description: "Build for PyPi"
1111

1212
jobs:
13-
1413
build_src_for_pypi:
1514
runs-on: ubuntu-latest
1615
steps:
1716
- uses: actions/checkout@v4
1817
with:
1918
persist-credentials: false
2019
submodules: true
20+
2121
- name: Install dependencies
2222
run: |
2323
pip install build
24+
2425
- name: Build src dist
2526
run: |
2627
cd codecov-cli
2728
python -m build --sdist
2829
env:
2930
PIP_CONSTRAINT: requirements.txt
31+
3032
- name: Store the distribution packages
3133
uses: actions/upload-artifact@v4
3234
with:
@@ -50,15 +52,18 @@ jobs:
5052
uses: actions/download-artifact@v4
5153
with:
5254
name: cibw-sdist
55+
5356
- name: Get sdist filename
5457
id: get-sdist
5558
run: |
5659
echo "sdist_filename=$(ls codecov-cli/dist/)" >> "${GITHUB_OUTPUT}"
5760
shell: bash
61+
5862
- name: Build wheels
5963
uses: pypa/cibuildwheel@v2.22.0
6064
with:
6165
package-dir: codecov-cli/dist/${{ steps.get-sdist.outputs.sdist_filename }}
66+
6267
- name: Store the distribution packages
6368
uses: actions/upload-artifact@v4
6469
with:

.github/workflows/ci-job.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ jobs:
1414
with:
1515
submodules: true
1616
fetch-depth: 2
17+
1718
- name: Set up Python 3.12
1819
uses: actions/setup-python@v5
1920
with:
2021
python-version: "3.12"
22+
2123
- name: Install dependencies
2224
run: |
2325
cd codecov-cli
2426
python -m pip install --upgrade pip
2527
pip install -r requirements.txt
2628
python -m pip install -e .
2729
pip install -r tests/requirements.txt
30+
2831
- name: Test with pytest
2932
run: |
3033
cd codecov-cli

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- uses: actions/checkout@v4
1919
with:
2020
submodules: true
21+
2122
- name: Check linting with ruff
2223
run: |
2324
make lint
@@ -28,18 +29,22 @@ jobs:
2829
- uses: actions/checkout@v4
2930
with:
3031
submodules: true
32+
3133
- name: Set up Python 3.12
3234
uses: actions/setup-python@v5
3335
with:
3436
python-version: "3.12"
37+
3538
- name: Install dependencies
3639
run: |
3740
python -m pip install --upgrade pip
3841
python -m pip install -e codecov-cli
3942
python -m pip install -e prevent-cli
43+
4044
- name: Run command_dump
4145
run: |
4246
./command_dump.py
47+
4348
- name: Detect changes on commit
4449
run: |
4550
if [ -n "$(git diff codecov-cli/codecovcli_commands prevent-cli/preventcli_commands)" ]; then
@@ -56,16 +61,20 @@ jobs:
5661
with:
5762
submodules: true
5863
fetch-depth: 2
64+
5965
- uses: actions/setup-python@v5
6066
with:
6167
python-version: "3.12"
68+
6269
- name: Install CLI
6370
# todo: update this to dogfood prevent cli, maybe try both?
6471
run: |
6572
pip install codecov-cli
73+
6674
- name: Create commit in codecov
6775
run: |
6876
codecovcli create-commit -t ${{ secrets.CODECOV_TOKEN }} --git-service github
77+
6978
- name: Create commit report in codecov
7079
run: |
7180
codecovcli create-report -t ${{ secrets.CODECOV_TOKEN }} --git-service github
@@ -82,27 +91,32 @@ jobs:
8291
with:
8392
submodules: true
8493
fetch-depth: 2
94+
8595
- name: Set up Python ${{matrix.python-version}}
8696
uses: actions/setup-python@v5
8797
with:
8898
python-version: "${{matrix.python-version}}"
99+
89100
- name: Install dependencies
90101
run: |
91102
python -m pip install --upgrade pip
92103
python -m pip install -e codecov-cli
93104
python -m pip install -e prevent-cli
94105
pip install -r codecov-cli/tests/requirements.txt
106+
95107
- name: Test with pytest
96108
run: |
97109
cd codecov-cli
98110
pytest --cov --junitxml=${{matrix.os}}-${{matrix.python-version}}junit.xml
99111
env:
100112
CODECOV_ENV: test
113+
101114
- name: Dogfooding codecov-cli
102115
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }}
103116
run: |
104117
codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli
105118
codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} --flag codecovcli
119+
106120
- name: Dogfooding sentry-prevent-cli
107121
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'getsentry' }}
108122
run: |

.github/workflows/release_flow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
with:
3838
path: dist/
3939
pattern: cibw-*
40+
4041
- name: Display and move artifacts
4142
run: |
4243
ls -alrt */*/*
@@ -47,6 +48,7 @@ jobs:
4748
echo "Deleting empty directories"
4849
find . -empty -type d -delete
4950
ls -alrt */*
51+
5052
- name: Publish package to PyPi
5153
uses: pypa/gh-action-pypi-publish@release/v1
5254
with:

0 commit comments

Comments
 (0)