Skip to content

Commit 5d5bff1

Browse files
Merge pull request #11 from arduino/release-tag
Add GitHub Actions workflow to generate releases
2 parents 85d23af + fcaf775 commit 5d5bff1

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/release-tag.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/release-tag.md
2+
name: Release
3+
4+
on:
5+
push:
6+
tags:
7+
- "v?[0-9]+.[0-9]+.[0-9]+*"
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
env:
16+
# See: https://github.com/fsaintjacques/semver-tool/releases
17+
SEMVER_TOOL_VERSION: 3.2.0
18+
19+
steps:
20+
- name: Set environment variables
21+
run: |
22+
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
23+
echo "CHANGELOG_PATH=${{ runner.temp }}/CHANGELOG.md" >> "$GITHUB_ENV"
24+
echo "SEMVER_TOOL_PATH=${{ runner.temp }}/semver" >> "$GITHUB_ENV"
25+
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Create changelog
32+
uses: arduino/create-changelog@v1
33+
with:
34+
tag-regex: '^v?[0-9]+\.[0-9]+\.[0-9]+.*$'
35+
filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*'
36+
case-insensitive-regex: true
37+
changelog-file-path: ${{ env.CHANGELOG_PATH }}
38+
39+
- name: Download semver tool
40+
id: download-semver-tool
41+
uses: carlosperate/download-file-action@v2
42+
with:
43+
file-url: https://github.com/fsaintjacques/semver-tool/archive/${{ env.SEMVER_TOOL_VERSION }}.zip
44+
location: ${{ runner.temp }}/semver-tool
45+
46+
- name: Install semver tool
47+
run: |
48+
unzip \
49+
-p \
50+
"${{ steps.download-semver-tool.outputs.file-path }}" \
51+
semver-tool-${{ env.SEMVER_TOOL_VERSION }}/src/semver > \
52+
"${{ env.SEMVER_TOOL_PATH }}"
53+
chmod +x "${{ env.SEMVER_TOOL_PATH }}"
54+
55+
- name: Identify Prerelease
56+
id: prerelease
57+
run: |
58+
if [[ \
59+
"$(
60+
"${{ env.SEMVER_TOOL_PATH }}" get prerel \
61+
"${GITHUB_REF/refs\/tags\//}"
62+
)" != \
63+
"" \
64+
]]; then
65+
echo "IS_PRE=true" >> $GITHUB_OUTPUT
66+
fi
67+
68+
- name: Create Github release
69+
uses: ncipollo/release-action@v1
70+
with:
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
bodyFile: ${{ env.CHANGELOG_PATH }}
73+
draft: false
74+
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
[![Check Go Dependencies status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-go-dependencies-task.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-go-dependencies-task.yml)
99
[![Check Taskfiles status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-taskfiles.yml)
1010
[![Check Workflows status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-workflows-task.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-workflows-task.yml)
11+
[![Release status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/release-tag.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/release-tag.yml)
1112

1213
<!--[![Test Go status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/test-go-task.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/test-go-task.yml)-->
1314
<!--[![Codecov](https://codecov.io/gh/arduino/fwuploader-plugin-helper/branch/main/graph/badge.svg)](https://codecov.io/gh/arduino/fwuploader-plugin-helper)-->

0 commit comments

Comments
 (0)