-
-
Notifications
You must be signed in to change notification settings - Fork 13
156 lines (134 loc) · 4.73 KB
/
release-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Release Build
on:
push:
tags:
- '**'
workflow_dispatch:
jobs:
# hub_build:
# name: Build for Docker Hub
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Fetch version
# id: version
# run: |
# export LAST_TAGGED_COMMIT=$(git rev-list --tags --max-count=1)
# export LAST_TAG=$(git describe --tags $LAST_TAGGED_COMMIT)
# echo "version=${LAST_TAG#v}" >> $GITHUB_OUTPUT
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# with:
# platforms: linux/amd64,linux/arm64
# - name: Sign in to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ github.repository_owner }}
# password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
# - name: Create image tags
# id: dockerinfo
# run: |
# echo "taglatest=${{ github.repository_owner }}/insights-bot:latest" >> $GITHUB_OUTPUT
# echo "tag=${{ github.repository_owner }}/insights-bot:${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
# - name: Build and Push
# uses: docker/build-push-action@v4
# with:
# context: ./
# file: ./Dockerfile
# push: true
# no-cache: false
# tags: |
# ${{ steps.dockerinfo.outputs.taglatest }}
# ${{ steps.dockerinfo.outputs.tag }}
goreleaser:
name: kollama - Build for GitHub Releases
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache: true
# Get values for cache paths to be used in later steps
- name: Setup Go Cache PATH
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update new version in krew-index
uses: rajatjindal/[email protected]
ghcr_build:
name: ollama-operator - Build for ghcr.io
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fetch version
id: version
run: |
export LAST_TAGGED_COMMIT=$(git rev-list --tags --max-count=1)
export LAST_TAG=$(git describe --tags $LAST_TAGGED_COMMIT)
echo "version=${LAST_TAG#v}" >> $GITHUB_OUTPUT
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Sign in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create image tags
id: dockerinfo
run: |
echo "taglatest=ghcr.io/${{ github.repository }}:latest" >> $GITHUB_OUTPUT
echo "tag=ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
- name: Build and Push
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: ./
file: ./Dockerfile
push: true
no-cache: false
tags: |
${{ steps.dockerinfo.outputs.taglatest }}
${{ steps.dockerinfo.outputs.tag }}
- name: Build installer
run: |
make build-installer IMG=ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: ollama-operator-installer-${{ steps.version.outputs.version }}
path: dist/install.yaml