-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (83 loc) · 2.46 KB
/
build.yaml
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
---
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
name: Multi Arch Build
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-unknown-linux-gnu
steps:
- name: Checkout boringtun
uses: actions/checkout@v2
with:
repository: cloudflare/boringtun
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target=${{ matrix.target }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/boringtun-cli
- id: sha
run: echo "::set-output name=sha::$(git describe --always --tags --dirty)"
outputs:
sha: ${{ steps.sha.outputs.sha }}
push:
name: docker build and push images
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: aarch64-unknown-linux-gnu
path: linux/arm64/
- uses: actions/download-artifact@v2
with:
name: armv7-unknown-linux-gnueabihf
path: linux/arm/v7/
- uses: actions/download-artifact@v2
with:
name: x86_64-unknown-linux-gnu
path: linux/amd64/
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER}}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/arm64, linux/arm, linux/amd64
push: true
build-args: |
FROM=debian:stable-slim
tags: |-
leonnicolas/boringtun:latest
leonnicolas/boringtun:${{ needs.build.outputs.sha }}
ghcr.io/leonnicolas/boringtun:latest
ghcr.io/leonnicolas/boringtun:${{ needs.build.outputs.sha }}