Skip to content

Commit 5b0ef1f

Browse files
authored
Merge pull request #15 from bitcraze/actionsv4
Support actions v4
2 parents d6cb1d2 + 032bb54 commit 5b0ef1f

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
read_targets_from_file:
15-
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@dfbc8c23a8ec6d4925d01deb20277839ad1235f1
15+
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@a5173df779e4b0b9c1f57d156cda9b8006901fd2
1616
with:
1717
target_file: './build_targets.json'
1818

@@ -26,9 +26,9 @@ jobs:
2626

2727
env:
2828
PLATFORM: ${{ matrix.platform }}
29-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030

3131
steps:
3232
- uses: actions/checkout@v4
3333
- name: Check and build
34-
run: docker run --rm -v ${PWD}:/module -e "GH_TOKEN=$GH_TOKEN" bitcraze/builder ./tools/build/build $PLATFORM
34+
run: docker run --rm -v ${PWD}:/module -e "GITHUB_TOKEN=$GITHUB_TOKEN" bitcraze/builder ./tools/build/build $PLATFORM

.github/workflows/nightly-experiment.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
read_targets_from_file:
13-
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@dfbc8c23a8ec6d4925d01deb20277839ad1235f1
13+
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@a5173df779e4b0b9c1f57d156cda9b8006901fd2
1414
with:
1515
target_file: './build_targets.json'
1616

@@ -31,9 +31,10 @@ jobs:
3131
- name: Check and build
3232
env:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
run: docker run --rm -v ${PWD}:/module -e "GH_TOKEN=$GITHUB_TOKEN" bitcraze/builder ./tools/build/build $PLATFORM nightly-experiment
34+
run: docker run --rm -v ${PWD}:/module -e "GITHUB_TOKEN=$GITHUB_TOKEN" bitcraze/builder ./tools/build/build $PLATFORM nightly-experiment
3535
- name: Upload Build Artifact
3636
uses: actions/upload-artifact@v4
3737
with:
38-
name: nightly-experiment
38+
name: ${{ matrix.platform }}-nightly-experiment
3939
path: firmware-${{ matrix.platform }}-nightly-experiment.zip
40+
overwrite: true

.github/workflows/nightly.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
read_targets_from_file:
12-
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@dfbc8c23a8ec6d4925d01deb20277839ad1235f1
12+
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@a5173df779e4b0b9c1f57d156cda9b8006901fd2
1313
with:
1414
target_file: './build_targets.json'
1515

@@ -29,11 +29,12 @@ jobs:
2929

3030
- name: Check and build
3131
env:
32-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
33-
run: docker run --rm -v ${PWD}:/module -e "GH_TOKEN=$GH_TOKEN" bitcraze/builder ./tools/build/build $PLATFORM nightly
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: docker run --rm -v ${PWD}:/module -e "GITHUB_TOKEN=$GITHUB_TOKEN" bitcraze/builder ./tools/build/build $PLATFORM nightly
3434

3535
- name: Upload Build Artifact
3636
uses: actions/upload-artifact@v4
3737
with:
38-
name: nightly
38+
name: ${{ matrix.platform }}-nightly
3939
path: firmware-${{ matrix.platform }}-nightly.zip
40+
overwrite: true

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
read_targets_from_file:
10-
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@dfbc8c23a8ec6d4925d01deb20277839ad1235f1
10+
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@a5173df779e4b0b9c1f57d156cda9b8006901fd2
1111
with:
1212
target_file: './build_targets.json'
1313

tools/build/package

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,17 @@ def _read_manifest(path, platform, versions):
4646

4747

4848
def _download_artifact(uri) -> io.BytesIO:
49-
headers = {}
50-
5149
# Add auth headers if the github token is available, on the build servers it is, but when running locally it is not.
5250
# Some operations do not require authentication but we do it anyway to avoid API call rate problems
53-
if 'GH_TOKEN' in os.environ:
54-
GH_TOKEN = os.environ['GH_TOKEN']
55-
headers = {'Authorization': f'token {GH_TOKEN}'}
51+
request = urllib.request.Request(url=uri)
52+
request.add_unredirected_header(key="Accept", val="application/vnd.github+json")
53+
if 'GITHUB_TOKEN' in os.environ:
54+
GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
55+
request.add_unredirected_header(key="Authorization", val=f"Bearer {GITHUB_TOKEN}")
5656
print(' Downloading with authorization')
5757
else:
5858
print(' Downloading without authorization')
59-
60-
req = urllib.request.Request(uri, headers=headers)
61-
with urllib.request.urlopen(req) as response:
59+
with urllib.request.urlopen(request) as response:
6260
data = response.read()
6361
assert (data)
6462
return io.BytesIO(data)

0 commit comments

Comments
 (0)