-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (88 loc) · 2.79 KB
/
vaccel-build-and-upload.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
name: Build QEMU+vAccel docker image
on:
push:
branches: [ '*+vaccel' ]
workflow_dispatch:
env:
REGISTRY: harbor.nbfc.io/nubificus
IMAGE_NAME: qemu-vaccel
APP: qemu-vaccel
jobs:
build:
name: Build Docker Image
runs-on: [self-hosted, gcc, lite, "${{ matrix.arch }}"]
strategy:
matrix:
#arch: [x86_64, aarch64]
arch: [x86_64]
outputs:
hash: ${{ steps.build-and-push.outputs.digest }}
tags: ${{ steps.meta.outputs.tags }}
permissions:
contents: read
id-token: write
steps:
- name: Cleanup previous jobs
run: |
echo "Cleaning up previous runs"
sudo rm -rf ${{ github.workspace }}/*
sudo rm -rf ${{ github.workspace }}/.??*
- name: Checkout code
uses: actions/checkout@v4
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_SECRET }}
- name: Extract Docker metadata
id: meta
#uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
#uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v6
with:
context: .
file: subprojects/vaccel/Dockerfile
no-cache: true
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARCHTAG=${{ matrix.arch }}
BRANCH=${{ github.event.ref_name | github.ref_name }}
sign:
name: Sign Docker Image
runs-on: [self-hosted]
needs: [build]
steps:
- name: Install Cosign
uses: sigstore/[email protected]
- name: Check install
run: cosign version
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: harbor.nbfc.io/nubificus
username: ${{ secrets.harbor_user }}
password: ${{ secrets.harbor_secret }}
- name: Sign published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
DIGEST: ${{ needs.build.outputs.hash }}
TAGS: ${{ needs.build.outputs.tags }}
run: |
cosign sign --yes harbor.nbfc.io/nubificus/${{ env.APP }}@${{ env.DIGEST }} \
-a "repo=${{ github.repository }}" \
-a "workflow=${{ github.workflow }}" \
-a "ref=${{ github.sha }}" \
-a "author=Nubificus LTD"
- name: Cleanup previous runs
if: ${{ always() }}
run: |
sudo rm -rf ${{ github.workspace }}/*
sudo rm -rf ${{ github.workspace }}/.??*