Skip to content

ci: change token

ci: change token #8

Workflow file for this run

on:
push:
branches: [main]
pull_request:
branches: [main]
name: Build
defaults:
run:
shell: bash
jobs:
lint:
name: Lint files
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.3'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
test:
name: Run tests
needs: lint
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.3'
- run: go test -v -cover
build:
name: Build binary
runs-on: 'ubuntu-latest'
needs: test
strategy:
matrix:
goosarch:
- 'darwin/amd64'
- 'darwin/arm64'
- 'linux/386'
- 'linux/amd64'
- 'linux/arm64'
- 'windows/386'
- 'windows/amd64'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.3'
- name: Gather OS and arch info
run: |
GOOSARCH=${{matrix.goosarch}}
GOOS=${GOOSARCH%/*}
GOARCH=${GOOSARCH#*/}
BINARY_NAME=${{github.repository}}-$GOOS-$GOARCH
ARTIFACT_NAME=${BINARY_NAME#*/}
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
echo "GOOS=$GOOS" >> $GITHUB_ENV
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
- name: Gather GitHub SHA
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BRANCH=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Build
run: |
go build -ldflags="-w -s -X github.com/marsskop/lightkeytool/cmd.version=$BRANCH-$SHORT_SHA" -o "$BINARY_NAME"
- name: Upload Build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.ARTIFACT_NAME}}
path: ${{env.BINARY_NAME}}