-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrelease-tag.yml
74 lines (64 loc) · 2.33 KB
/
release-tag.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
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/release-tag.md
name: Release
on:
push:
tags:
- "v?[0-9]+.[0-9]+.[0-9]+*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
# See: https://github.com/fsaintjacques/semver-tool/releases
SEMVER_TOOL_VERSION: 3.2.0
steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
echo "CHANGELOG_PATH=${{ runner.temp }}/CHANGELOG.md" >> "$GITHUB_ENV"
echo "SEMVER_TOOL_PATH=${{ runner.temp }}/semver" >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create changelog
uses: arduino/create-changelog@v1
with:
tag-regex: '^v?[0-9]+\.[0-9]+\.[0-9]+.*$'
filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*'
case-insensitive-regex: true
changelog-file-path: ${{ env.CHANGELOG_PATH }}
- name: Download semver tool
id: download-semver-tool
uses: carlosperate/download-file-action@v2
with:
file-url: https://github.com/fsaintjacques/semver-tool/archive/${{ env.SEMVER_TOOL_VERSION }}.zip
location: ${{ runner.temp }}/semver-tool
- name: Install semver tool
run: |
unzip \
-p \
"${{ steps.download-semver-tool.outputs.file-path }}" \
semver-tool-${{ env.SEMVER_TOOL_VERSION }}/src/semver > \
"${{ env.SEMVER_TOOL_PATH }}"
chmod +x "${{ env.SEMVER_TOOL_PATH }}"
- name: Identify Prerelease
id: prerelease
run: |
if [[ \
"$(
"${{ env.SEMVER_TOOL_PATH }}" get prerel \
"${GITHUB_REF/refs\/tags\//}"
)" != \
"" \
]]; then
echo "IS_PRE=true" >> $GITHUB_OUTPUT
fi
- name: Create Github release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
bodyFile: ${{ env.CHANGELOG_PATH }}
draft: false
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}