Skip to content

Commit

Permalink
ci: add build and publish step
Browse files Browse the repository at this point in the history
Signed-off-by: r3drun3 <[email protected]>
  • Loading branch information
R3DRUN3 committed Jan 3, 2025
1 parent 880ff0e commit 4199520
Showing 1 changed file with 53 additions and 15 deletions.
68 changes: 53 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ on:
pull_request:
branches:
- main
push:
tags:
- 'v*.*.*' # Trigger on semantic versioning tags

permissions:
contents: read
contents: write
id-token: write

jobs:
Expand All @@ -23,22 +26,57 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
- name: Run GolangCI-Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60

security:
name: Security Scanning
runs-on: ubuntu-latest
permissions:
contents: read
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude=G301, G304, G306
name: Security Scanning
runs-on: ubuntu-latest
permissions:
contents: read
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude=G301,G304,G306

build-and-publish:
name: Build and Publish Binaries
runs-on: ubuntu-latest
needs:
- lint
- security
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Build for Linux x86_64
run: |
GOOS=linux GOARCH=amd64 go build -o cli-tool-linux-amd64
- name: Build for Linux ARM
run: |
GOOS=linux GOARCH=arm64 go build -o cli-tool-linux-arm64
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./cli-tool-linux-amd64
asset_name: cli-tool-linux-amd64
asset_content_type: application/octet-stream
- name: Upload ARM Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./cli-tool-linux-arm64
asset_name: cli-tool-linux-arm64
asset_content_type: application/octet-stream

0 comments on commit 4199520

Please sign in to comment.