-
Notifications
You must be signed in to change notification settings - Fork 1.1k
86 lines (74 loc) · 2.54 KB
/
release.yml
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
# Release jobs
name: Release
on:
workflow_dispatch:
permissions:
contents: read
jobs:
read_targets_from_file:
uses: bitcraze/workflows/.github/workflows/read_build_targets.yml@cc82f0e5999c39eff964dd73ce9363e94d5b5b76
with:
target_file: './build_targets.json'
release:
permissions:
contents: write # for actions/create-release to create a release
name: Create Release on Github
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: true
- name: Release URL on file
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File For Uploading Files
uses: actions/upload-artifact@v4
with:
name: release_url
path: release_url.txt
upload:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
name: Upload Binaries to release
needs: [release, read_targets_from_file]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
${{fromJson(needs.read_targets_from_file.outputs.platforms)}}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: docker run --rm -v ${PWD}:/module bitcraze/builder bash -c "make ${{ matrix.platform }}_defconfig && ./tools/build/build PLATFORM=${{ matrix.platform }} UNIT_TEST_STYLE=min"
- name: Load Release URL File from release job
uses: actions/download-artifact@v4
with:
name: release_url
- name: Get Release File Name & Upload URL
id: get_release_info
run: |
value=`cat release_url.txt`
echo "upload_url=$value" >> $GITHUB_OUTPUT
- name: Get the version
id: get_release_version
env:
GITHUB_REF : ${{ github.ref }}
run: echo "release_version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Upload ${{ matrix.platform }} bin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: build/${{ matrix.platform }}.bin
asset_name: ${{ matrix.platform }}-${{ steps.get_release_version.outputs.release_version }}.bin
asset_content_type: application/octet-stream