Merge pull request #40 from credativ/2.2.18 #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
pull_request: | |
jobs: | |
logcli: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21.6 | |
- name: Install package dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y make protobuf-compiler zip | |
- name: Install Go dependencies | |
run: | | |
go install github.com/golang/protobuf/protoc-gen-go@v1.3.0 | |
go install github.com/gogo/protobuf/protoc-gen-gogoslick@v1.2.1 | |
- name: Pre-generate code | |
run: make BUILD_IN_CONTAINER=false generate | |
- name: Build logcli | |
run: make BUILD_IN_CONTAINER=false logcli | |
env: | |
GOARCH: ${{ matrix.arch }} | |
- name: Zip logcli | |
run: zip --junk-paths logcli_${{ matrix.arch }}.zip cmd/logcli/logcli | |
- name: Upload logcli as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logcli_${{ matrix.arch }} | |
path: logcli_${{ matrix.arch }}.zip | |
retention-days: 3 | |
release: | |
runs-on: ubuntu-latest | |
needs: logcli | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Create draft release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/logcli_*/logcli_*.zip" | |
artifactErrorsFailBuild: true | |
bodyFile: ".github/release_template.md" | |
draft: true |