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