-
Notifications
You must be signed in to change notification settings - Fork 4
116 lines (111 loc) · 3.11 KB
/
cmd.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
name: cmd
permissions:
contents: write
actions: read
id-token: write
defaults:
run:
shell: bash
on:
push:
branches:
- 'main'
- 'branch-v*.*'
paths-ignore:
- "docs/**"
- "**.md"
- "**.mdx"
- "**.png"
- "**.jpg"
- "!.github/workflows/ci.yml"
tags:
- "v*.*.*"
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false
- name: Setup Go
timeout-minutes: 15
uses: actions/setup-go@v5
with:
go-version: "1.22.9"
cache-dependency-path: |
**/go.sum
- name: Make
run: make build
env:
VERSION: "${{ github.ref_name }}"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
path: ${{ github.workspace }}/.dist/*
- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
tag_name: "${{ github.ref_name }}"
prerelease: ${{ contains(github.ref, 'rc') }}
files: ${{ github.workspace }}/.dist/*
publish:
needs:
- build
permissions:
contents: write
actions: read
id-token: write
timeout-minutes: 15
runs-on: ubuntu-22.04
env:
PACKAGE_REGISTRY: "gpustack"
PACKAGE_IMAGE: "gguf-parser"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0
platforms: "arm64"
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Login DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
password: ${{ secrets.CI_DOCKERHUB_PASSWORD }}
- name: Download Artifact
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/.dist
merge-multiple: true
- name: Get Metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: "${{ env.PACKAGE_REGISTRY }}/${{ env.PACKAGE_IMAGE }}"
- name: Package
uses: docker/build-push-action@v6
with:
push: true
file: ${{ github.workspace }}/Dockerfile
context: ${{ github.workspace }}
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: |
type=registry,ref=${{ env.PACKAGE_REGISTRY }}/${{ env.PACKAGE_IMAGE }}:build-cache
cache-to: |
type=registry,mode=max,oci-mediatypes=false,compression=gzip,ref=${{ env.PACKAGE_REGISTRY }}/${{ env.PACKAGE_IMAGE }}:build-cache,ignore-error=true
provenance: true
sbom: true