Skip to content

Commit f73db2c

Browse files
committed
Migrate GitHub Actions
1 parent 775cc1d commit f73db2c

4 files changed

Lines changed: 77 additions & 88 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 0 additions & 87 deletions
This file was deleted.

‎.github/workflows/.ghctl_cd.yaml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ghctl CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v4
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version: "1.25.6"
16+
- name: Build for multiple architectures
17+
run: |
18+
GOOS=darwin GOARCH=amd64 go build -o artifacts/${{ vars.PROJECT_REPONAME }}_darwin_amd64
19+
GOOS=linux GOARCH=amd64 go build -o artifacts/${{ vars.PROJECT_REPONAME }}_linux_amd64
20+
GOOS=windows GOARCH=amd64 go build -o artifacts/${{ vars.PROJECT_REPONAME }}_windows_amd64.exe
21+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -o artifacts/${{ vars.PROJECT_REPONAME }}_alpinelinux_amd64
22+
- name: Build yq for alpine image
23+
run: |
24+
git clone git@github.com:mikefarah/yq.git
25+
cd yq
26+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a
27+
- name: Publish to DockerHub
28+
run: |
29+
cp artifacts/${{ vars.PROJECT_REPONAME }}_alpinelinux_amd64 ./${{ vars.PROJECT_REPONAME }}
30+
VERSION=$(./artifacts/${{ vars.PROJECT_REPONAME }}_linux_amd64 --version)
31+
echo "${{ secrets.DOCKER_PASS }}" | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
32+
IMAGE_NAME=${{ secrets.DOCKER_USER }}/${{ vars.PROJECT_REPONAME }}
33+
docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$VERSION .
34+
docker push $IMAGE_NAME:$VERSION
35+
docker push $IMAGE_NAME:latest
36+
- name: List artifacts
37+
run: ls -lah artifacts/
38+
- name: Publish Release on GitHub
39+
run: |
40+
go get github.com/tcnksm/ghr
41+
VERSION=v$(./artifacts/${{ vars.PROJECT_REPONAME }}_linux_amd64 --version)
42+
ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${{ vars.PROJECT_USERNAME }} -r ${{ vars.PROJECT_REPONAME }} -c ${{ github.sha }} -n ${VERSION} -delete ${VERSION} ./artifacts/

‎.github/workflows/.ghctl_ci.yaml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: ghctl CI Pipeline
2+
3+
on:
4+
push:
5+
# pull_request:
6+
# branches: [master]
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
- name: Set up Go environment
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: "1.16"
18+
# go-version: "1.25.6"
19+
- name: Build
20+
run: go build
21+
- name: Lint
22+
run: |
23+
go get -u golang.org/x/tools@v0.0.0-20200825202427-b303f430e36d
24+
$(go env GOPATH)/bin/golint ./...
25+
- name: "Vet: report likely mistakes in packages"
26+
run: go vet ./...
27+
- name: Unit Test
28+
run: go test ./... -v
29+
- name: Run Snyk to check for vulnerabilities
30+
uses: snyk/actions/golang@master
31+
env:
32+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
33+
- name: Get version
34+
run: ./ghctl --version

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
artifacts/
1414
run*.sh
1515
ghctl
16-
*.yaml
16+
files/

0 commit comments

Comments
 (0)