2024-02-21 19:05:56 +01:00
|
|
|
name: Build Golang packages
|
|
|
|
on:
|
2024-02-21 19:02:51 +01:00
|
|
|
push:
|
2024-02-21 19:05:56 +01:00
|
|
|
branches:
|
|
|
|
- "**"
|
2024-02-21 19:02:51 +01:00
|
|
|
tags:
|
2024-02-21 19:05:56 +01:00
|
|
|
- "v*.*.*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "main"
|
2024-02-21 19:02:51 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
2024-02-21 19:06:21 +01:00
|
|
|
runs-on: ubuntu-docker
|
2024-02-21 19:02:51 +01:00
|
|
|
steps:
|
2024-02-21 19:27:14 +01:00
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
2024-02-21 19:10:20 +01:00
|
|
|
uses: actions/setup-go@v4
|
2024-02-21 19:02:51 +01:00
|
|
|
with:
|
|
|
|
go-version: '>=1.x'
|
|
|
|
- name: release-build-linux-amd64
|
2024-02-21 19:05:56 +01:00
|
|
|
run: GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-amd64
|
2024-02-21 19:02:51 +01:00
|
|
|
- name: release-build-linux-arm64
|
2024-02-21 19:05:56 +01:00
|
|
|
run: GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-linux-arm64
|
2024-02-21 19:02:51 +01:00
|
|
|
- name: release-build-windows-amd64
|
2024-02-21 19:05:56 +01:00
|
|
|
run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-windows-amd64.exe
|
2024-02-21 19:02:51 +01:00
|
|
|
- name: release-build-windows-arm64
|
2024-02-21 19:05:56 +01:00
|
|
|
run: GOOS=windows GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-windows-arm64.exe
|
2024-02-21 19:02:51 +01:00
|
|
|
- name: release-build-darwin-amd64
|
2024-02-21 19:05:56 +01:00
|
|
|
run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-darwin-amd64
|
2024-02-21 19:02:51 +01:00
|
|
|
- name: release-build-darwin-arm64
|
2024-02-21 19:05:56 +01:00
|
|
|
run: GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-darwin-arm64
|
2024-02-21 19:02:51 +01:00
|
|
|
|
2024-02-21 19:27:14 +01:00
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
|
|
|
env:
|
|
|
|
GITEA_TOKEN: ${{ secrets.CI_PACKAGES_RW }}
|
|
|
|
run: |
|
|
|
|
RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" -H "Authorization: token ${GITEA_TOKEN}" \
|
|
|
|
-d '{
|
|
|
|
"tag_name": "${{ github.ref_name }}",
|
|
|
|
"target_commitish": "main",
|
|
|
|
"name": "Release ${{ github.ref_name }}",
|
|
|
|
"body": "Description of the release",
|
|
|
|
"draft": false,
|
|
|
|
"prerelease": false
|
|
|
|
}' \
|
|
|
|
"https://git.hollander.online/api/v1/repos/${{ gitea.repository_owner }}/${{ gitea.event.repository.name }}/releases")
|
|
|
|
echo "::set-output name=id::$(echo $RESPONSE | jq .id)"
|