Skip to content

docs: update readme #106

docs: update readme

docs: update readme #106

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches: [ master ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
outputs:
git_tag: ${{ steps.semantic_release_info.outputs.git_tag }}
version: ${{ steps.semantic_release_info.outputs.version }}
notes: ${{ steps.semantic_release_info.outputs.notes }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for 2ms to have visibility to all commit history
- uses: actions/setup-go@v4
with:
go-version: "^1.20"
- name: Go Linter
run: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.52.0 golangci-lint run -v -E gofmt --timeout=5m
- name: Run 2ms Scan
run: docker run -v $(pwd):/repo checkmarx/2ms:2.8.1 git /repo --config /repo/.2ms.yml
- name: Unit Tests
run: go test ./...
- name: Gets release info
id: semantic_release_info
if: github.event_name == 'workflow_dispatch'
uses: jossef/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build and Release
runs-on: ubuntu-latest
needs: test
if: ${{ needs.test.outputs.git_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "^1.20"
- name: Go Mod Tidy
run: go mod tidy
- name: Compile for Linux amd64
env:
VERSION: ${{ needs.test.outputs.version }}
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
run: |
go build -ldflags "-s -w -X github.com/checkmarx/2ms/cmd.Version=$VERSION" -a -installsuffix cgo -o dist/2ms main.go
zip -j dist/linux-amd64.zip dist/2ms
rm dist/2ms
- name: Compile for MacOS amd64
env:
VERSION: ${{ needs.test.outputs.version }}
CGO_ENABLED: 0
GOOS: darwin
GOARCH: amd64
run: |
go build -ldflags "-s -w -X github.com/checkmarx/2ms/cmd.Version=$VERSION" -a -installsuffix cgo -o dist/2ms main.go
zip -j dist/macos-amd64.zip dist/2ms
rm dist/2ms
- name: Compile for MacOS arm64
env:
VERSION: ${{ needs.test.outputs.version }}
CGO_ENABLED: 0
GOOS: darwin
GOARCH: arm64
run: |
go build -ldflags "-s -w -X github.com/checkmarx/2ms/cmd.Version=$VERSION" -a -installsuffix cgo -o dist/2ms main.go
zip -j dist/macos-arm64.zip dist/2ms
rm dist/2ms
- name: Compile for Windows amd64
env:
VERSION: ${{ needs.test.outputs.version }}
CGO_ENABLED: 0
GOOS: windows
GOARCH: amd64
run: |
go build -ldflags "-s -w -X github.com/checkmarx/2ms/cmd.Version=$VERSION" -a -installsuffix cgo -o dist/2ms.exe main.go
zip -j dist/windows-amd64.zip dist/2ms.exe
rm dist/2ms.exe
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Creating Release
uses: softprops/[email protected]
with:
tag_name: ${{ needs.test.outputs.git_tag }}
name: ${{ needs.test.outputs.git_tag }}
body: ${{ needs.test.outputs.notes }}
target_commitish: ${{ steps.commit_and_push.outputs.latest_commit_hash }}
files: |
dist/*.zip
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
checkmarx/2ms:latest
checkmarx/2ms:${{ needs.test.outputs.version }}
- name: Update Docker repo description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: checkmarx/2ms