|
| 1 | +on: |
| 2 | + push: |
| 3 | + # Require one of the following patterns to match the tag |
| 4 | + tags: |
| 5 | + - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+' # ex. v20.00.00.00 |
| 6 | + - 'v[0-9]+.[0-9]+.RC.[0-9]+' # ex. v20.00.RC.00 |
| 7 | + |
| 8 | +name: Create Release |
| 9 | + |
| 10 | +env: |
| 11 | + PROJECT_NAME: cmsis-svd-generator |
| 12 | + # Release is a prerelease if the tag contains rc |
| 13 | + PRERELEASE: ${{ contains(github.ref, 'RC') }} |
| 14 | + |
| 15 | +jobs: |
| 16 | + release: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: 'Checkout' |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + # In order to generate release notes, we need a deep clone of the |
| 24 | + # repository so that we can find the most recent tag and generate |
| 25 | + # statistics based on it. |
| 26 | + - name: 'Fetch History' |
| 27 | + run: git fetch --prune --unshallow |
| 28 | + |
| 29 | + - name: 'Create Release Notes' |
| 30 | + id: create-release-notes |
| 31 | + run: | |
| 32 | + tag=$(echo ${{ github.ref }} | cut -d '/' -f 3) |
| 33 | + release_notes=$(./scripts/create-release-notes.sh ${{ env.PROJECT_NAME }} ${tag}) |
| 34 | + # The string passed to Actions must urlencode newlines. |
| 35 | + release_notes="${release_notes//$'\n'/'%0A'}" |
| 36 | + # Use a magic "workflow command" to set the output for the step. |
| 37 | + echo "::set-output name=release-notes::${release_notes}" |
| 38 | +
|
| 39 | + - name: 'Create Release' |
| 40 | + uses: actions/create-release@v1 |
| 41 | + env: |
| 42 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + with: |
| 44 | + tag_name: ${{ github.ref }} |
| 45 | + release_name: ${{ env.PROJECT_NAME }} ${{ github.ref }} |
| 46 | + body: ${{ steps.create-release-notes.outputs.release-notes }} |
| 47 | + draft: false |
| 48 | + prerelease: ${{ env.PRERELEASE }} |
0 commit comments