Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
virusdefender committed Nov 8, 2021
1 parent 9ee4f1b commit 03e24a2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Go

on:
push:
branches: [ main ]
tags: ["v*.*.*"]
pull_request:
branches: [ main ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Build
run: |
build() {
export GOOS=$1
export GOARCH=$2
go build -ldflags "-s -w" -o build/cert-copier-${1}-${2}${3} main.go
}
build linux amd64
build windows amd64 .exe
build windows 386 .exe
build darwin amd64
build darwin arm64
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
path: build/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/*
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
)

Expand Down Expand Up @@ -108,7 +109,8 @@ var fileNameRegex = regexp.MustCompile(`[^a-zA-Z0-9_\-.]`)

func main() {
if len(os.Args) != 2 {
log.Fatal("usage: go run main.go $addr, for example: go run main.go github.com:443")
name := filepath.Base(os.Args[0])
log.Fatalf("usage: %s $addr, for example: %s github.com:443", name, name)
}
certs, err := getCertsFromNetwork(os.Args[1])
if err != nil {
Expand Down

0 comments on commit 03e24a2

Please sign in to comment.