Skip to content

Merge pull request #285 from arduino/disable-cgo #9

Merge pull request #285 from arduino/disable-cgo

Merge pull request #285 from arduino/disable-cgo #9

Workflow file for this run

name: Create Release
env:
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
GO_VERSION: "1.23"
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/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
TAG_SHORT_NAME="${GITHUB_REF/refs\/tags\//}"
echo "TAG_SHORT_NAME=$TAG_SHORT_NAME" >> "$GITHUB_ENV"
echo "ARCHIVE_PATH=${{ runner.temp }}/libraries-repository-engine_${TAG_SHORT_NAME}_Linux_64bit.tar.gz" \
>> "$GITHUB_ENV"
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: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build project
run: task build
- name: Archive release binary
run: |
tar \
--create \
--add-file="./libraries-repository-engine" \
--add-file="./LICENSE.txt" \
--gzip \
--file="${{ env.ARCHIVE_PATH }}"
- 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 Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
bodyFile: ${{ env.CHANGELOG_PATH }}
prerelease: ${{ steps.prerelease.outputs.is-pre }}
artifacts: ${{ env.ARCHIVE_PATH }}