1name: Create a Release
2
3on:
4  push:
5    tags:
6      - 'v*'
7      - '!v*rc*'
8
9permissions:
10  contents: read
11
12jobs:
13  release:
14    runs-on: ubuntu-24.04
15    permissions:
16      contents: write # to create GitHub release entry
17    steps:
18      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19        with:
20          fetch-depth: 0
21
22      - name: Get the version
23        id: get_version
24        run: |
25          echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
26          echo "TRIMMED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
27
28      - name: REUSE Compliance Check
29        uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0
30        with:
31          args: spdx -o zephyr-${{ steps.get_version.outputs.VERSION }}.spdx
32
33      - name: upload-results
34        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
35        continue-on-error: true
36        with:
37          name: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx
38          path: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx
39
40      - name: Create empty release notes body
41        run: |
42          echo "TODO: add release overview and notes link" > release-notes.txt
43
44      - name: Create Release
45        id: create_release
46        uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
47        env:
48          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49        with:
50          tag_name: ${{ github.ref }}
51          release_name: Zephyr ${{ steps.get_version.outputs.TRIMMED_VERSION }}
52          body_path: release-notes.txt
53          draft: true
54          prerelease: true
55
56      - name: Upload Release Assets
57        id: upload-release-asset
58        uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
59        env:
60          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61        with:
62          upload_url: ${{ steps.create_release.outputs.upload_url }}
63          asset_path: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx
64          asset_name: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx
65          asset_content_type: text/plain
66