Skip to content

Commit 54390af

Browse files
committed
feat: add GitHub Actions workflow for releasing arduino-app-cli
1 parent 2122fa8 commit 54390af

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflow/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release arduino-app-cli
2+
3+
on:
4+
push:
5+
tags:
6+
- "*" # Trigger on all tags
7+
8+
env:
9+
GO_VERSION: "1.25.1"
10+
PROJECT_NAME: "arduino-app-cli"
11+
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
12+
GITHUB_USERNAME: ArduinoBot
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
os: [ubuntu-22.04]
19+
arch: [amd64, arm64]
20+
include:
21+
- os: ubuntu-22.04
22+
platform-name: linux
23+
24+
runs-on: ${{ matrix.os }}
25+
26+
steps:
27+
- name: Set env vars
28+
run: |
29+
echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
30+
echo "creating tag ${TAG_VERSION}"
31+
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Configure Git for private repo cloning
38+
run: |
39+
git config --global url."https://${{ env.GITHUB_USERNAME }}:${{ env.GITHUB_TOKEN }}@github.com".insteadOf "https://github.com"
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: ${{ env.GO_VERSION }}
45+
46+
- name: Install Task
47+
uses: arduino/setup-task@v2
48+
with:
49+
version: 3.x
50+
repo-token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Build Binary
53+
env:
54+
GOARCH: ${{ matrix.arch }}
55+
run: |
56+
export CGO_ENABLED=0
57+
58+
mkdir -p build
59+
go build -v -ldflags "-s -w -X 'main.Version=${TAG_VERSION}'" -o ./build/${{ env.PROJECT_NAME }} ./cmd/arduino-app-cli
60+
chmod +x ./build/${{ env.PROJECT_NAME }}
61+
tar -czvf ./build/${{ env.PROJECT_NAME }}-${TAG_VERSION}-${{ matrix.platform-name }}-${{ matrix.arch }}.tar.gz -C ./build ${{ env.PROJECT_NAME }}
62+
rm ./build/${{ env.PROJECT_NAME }}
63+
64+
- name: Build deb
65+
if: matrix.platform-name == 'linux'
66+
run: |
67+
task build-deb VERSION=${TAG_VERSION} ARCH=${{ matrix.arch }} RELEASE="true"
68+
69+
- name: Create Github Release and upload artifacts
70+
uses: ncipollo/release-action@v1
71+
with:
72+
token: ${{ secrets.GITHUB_TOKEN }}
73+
draft: false
74+
prerelease: true
75+
artifacts: build/*.tar.gz,build/*.deb
76+
allowUpdates: true

0 commit comments

Comments
 (0)