Skip to content

Commit 2caf5b1

Browse files
add github ci changes and other minor updates
1 parent e003376 commit 2caf5b1

File tree

5 files changed

+167
-2
lines changed

5 files changed

+167
-2
lines changed

Diff for: .github/workflows/golangci-lint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
jobs:
8+
golangci:
9+
name: lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/setup-go@v4
13+
with:
14+
go-version: "1.23"
15+
cache: false
16+
- uses: actions/checkout@v3
17+
- name: golangci-lint
18+
uses: golangci/golangci-lint-action@v3
19+
with:
20+
version: v1.62.0
21+
args: "--timeout=5m"

Diff for: .github/workflows/tag-release.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: semver tag
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
attestations: write
11+
packages: write
12+
13+
env:
14+
CRUSOE_CLOUD_CONTROLLER_MANAGER_NAME: ccm.crusoe.ai
15+
16+
jobs:
17+
semver-tag:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up Git
26+
run: |
27+
git config user.name "crusoe-cloud"
28+
git config user.email "support@crusoecloud.com"
29+
30+
- name: Load versions from text file
31+
run: |
32+
source versions.env
33+
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> $GITHUB_ENV
34+
echo "MINOR_VERSION=${MINOR_VERSION}" >> $GITHUB_ENV
35+
36+
- name: Calculate and set new version
37+
run: |
38+
chmod +x ./scripts/tag_semver.sh
39+
./scripts/tag_semver.sh $MAJOR_VERSION $MINOR_VERSION ""
40+
shell: bash
41+
42+
- name: Read version and push tag
43+
run: |
44+
source variables.env
45+
echo "Calculated version: $RELEASE_VERSION"
46+
source variables.env
47+
git tag $RELEASE_VERSION
48+
git push origin $RELEASE_VERSION
49+
goreleaser:
50+
needs: semver-tag
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
54+
with:
55+
# Allow goreleaser to access older tag information.
56+
fetch-depth: 0
57+
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
58+
with:
59+
go-version-file: 'go.mod'
60+
cache: true
61+
- name: Set up QEMU
62+
uses: docker/setup-qemu-action@v3
63+
- name: Set up Docker Buildx
64+
uses: docker/setup-buildx-action@v3
65+
- name: Login to GitHub Container Registry
66+
uses: docker/login-action@v3
67+
with:
68+
registry: ghcr.io
69+
username: ${{ github.actor }}
70+
password: ${{ secrets.GITHUB_TOKEN }}
71+
- name: Import GPG key
72+
uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # v5.3.0
73+
id: import_gpg
74+
with:
75+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
76+
passphrase: ${{ secrets.PASSPHRASE }}
77+
- name: Run GoReleaser
78+
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
79+
with:
80+
args: release --clean
81+
version: 2.1.x
82+
env:
83+
# GitHub sets the GITHUB_TOKEN secret automatically.
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

Diff for: .goreleaser.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: 2
2+
# Visit https://goreleaser.com for documentation on how to customize this
3+
# behavior.
4+
before:
5+
hooks:
6+
- go mod tidy
7+
builds:
8+
- main: ./cmd/crusoe-cloud-controller-manager/main.go
9+
env:
10+
- CGO_ENABLED=0
11+
mod_timestamp: '{{.CommitTimestamp }}'
12+
flags:
13+
- -trimpath
14+
ldflags:
15+
- "-X 'github.com/crusoecloud/crusoe-cloud-controller-manager/internal/ccm.version={{ .Tag }}' -X 'github.com/crusoecloud/crusoe-cloud-controller-manager/internal/ccm.name={{ .Env.CRUSOE_CLOUD_CONTROLLER_MANAGER_NAME }}'"
16+
goos:
17+
- linux
18+
goarch:
19+
- amd64
20+
- arm64
21+
binary: '{{ .ProjectName }}'
22+
dockers:
23+
- image_templates:
24+
- 'ghcr.io/crusoecloud/{{ .ProjectName }}:{{ .Tag }}-amd64'
25+
use: buildx
26+
build_flag_templates:
27+
- "--pull"
28+
- "--platform=linux/amd64"
29+
dockerfile: Dockerfile.goreleaser
30+
- image_templates:
31+
- 'ghcr.io/crusoecloud/{{ .ProjectName }}:{{ .Tag }}-arm64'
32+
use: buildx
33+
build_flag_templates:
34+
- "--pull"
35+
- "--platform=linux/arm64"
36+
dockerfile: Dockerfile.goreleaser
37+
goarch: arm64
38+
docker_manifests:
39+
- name_template: 'ghcr.io/crusoecloud/{{ .ProjectName }}:{{ .Tag }}'
40+
image_templates:
41+
- 'ghcr.io/crusoecloud/{{ .ProjectName }}:{{ .Tag }}-amd64'
42+
- 'ghcr.io/crusoecloud/{{ .ProjectName }}:{{ .Tag }}-arm64'
43+
signs:
44+
- artifacts: checksum
45+
args:
46+
# if you are using this in a GitHub action or some other automated pipeline, you
47+
# need to pass the batch flag to indicate its not interactive.
48+
- "--batch"
49+
- "--local-user"
50+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
51+
- "--output"
52+
- "${signature}"
53+
- "--detach-sign"
54+
- "${artifact}"
55+
56+
changelog:
57+
disable: true

Diff for: Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PREFIX?=$(shell pwd)
22

33
NAME := crusoe-cloud-controller-manager
4-
PKG := gitlab.com/crusoeenergy/island/external/crusoe-cloud-controller-manager/cmd/crusoe-cloud-controller-manager
4+
PKG := github.com/crusoecloud/crusoe-cloud-controller-manager/cmd/$(NAME)
55

66
BUILDDIR := ${PREFIX}/dist
77
# Set any default go build tags
@@ -15,6 +15,8 @@ GOCOVER_VERSION = latest
1515
GOARCH=amd64
1616
OS := linux
1717

18+
GO_LDFLAGS=-ldflags "-X 'github.com/crusoecloud/crusoe-cloud-controller-manager/internal/ccm.version=$$CRUSOE_CLOUD_CONTROLLER_MANAGER_VERSION' -X 'github.com/crusoecloud/crusoe-cloud-controller-manager/internal/ccm.name=$$CRUSOE_CLOUD_CONTROLLER_MANAGER_NAME'"
19+
1820
.PHONY: run
1921
run:
2022
go run cmd/main.go

Diff for: releases/crusoe-cloud-controller-manager/v0.1.2.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
topologyKey: "kubernetes.io/hostname"
5959
containers:
6060
- name: crusoe-cloud-controller-manager
61-
image: crusoe-cloud-controller-manager:0.26
61+
image: ghcr.io/crusoecloud/crusoe-cloud-controller-manager:v0.1.0
6262
imagePullPolicy: IfNotPresent
6363
command:
6464
- "/bin/crusoe-cloud-controller-manager"

0 commit comments

Comments
 (0)