-
Notifications
You must be signed in to change notification settings - Fork 15
110 lines (97 loc) · 3.39 KB
/
main.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
name: Build
on: [push]
permissions:
id-token: write
packages: write
contents: read
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Retrieve environment variables
run: make env >> $GITHUB_ENV
- name: Copy default Cartesi Linux config
run: make cartesi-linux-config
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/linux-kernel
docker.io/${{ github.repository_owner }}/linux-kernel,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v') }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download dependencies
run: make download
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build docker image
id: docker_build
uses: depot/build-push-action@v1
with:
context: .
platforms: linux/amd64,linux/arm64
tags: cartesi/linux-kernel:devel
push: false
load: true
build-args: |
TOOLCHAIN_REPOSITORY=${{ env.TOOLCHAIN_REPOSITORY }}
TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }}
KERNEL_VERSION=${{ env.KERNEL_VERSION }}
KERNEL_TIMESTAMP=${{ env.KERNEL_TIMESTAMP }}
IMAGE_KERNEL_VERSION=${{ env.IMAGE_KERNEL_VERSION }}
OPENSBI_VERSION=${{ env.OPENSBI_VERSION }}
cache-from: type=gha,scope=regular
cache-to: type=gha,mode=max,scope=regular
project: ${{ vars.DEPOT_PROJECT }}
- name: Export linux.bin artifact
run: make copy
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: artifacts/*
- name: Checksum artifacts
shell: bash
run: |
for f in artifacts/*; do
sha512sum $f > $f.sha512
done
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
prerelease: true
files: |
artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
- name: Push docker image
id: docker_push
uses: depot/build-push-action@v1
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
push: true
load: false
build-args: |
TOOLCHAIN_REPOSITORY=${{ env.TOOLCHAIN_REPOSITORY }}
TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }}
KERNEL_VERSION=${{ env.KERNEL_VERSION }}
IMAGE_KERNEL_VERSION=${{ env.IMAGE_KERNEL_VERSION }}
OPENSBI_VERSION=${{ env.OPENSBI_VERSION }}
cache-from: type=gha,scope=regular
cache-to: type=gha,mode=max,scope=regular
project: ${{ vars.DEPOT_PROJECT }}