-
-
Notifications
You must be signed in to change notification settings - Fork 579
110 lines (89 loc) · 2.87 KB
/
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
on:
push:
tags:
- "v*.*.*"
name: Build and Release
jobs:
build-releases:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache build artifacts
id: cache-cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
target
key: build-${{ runner.os }}-cargo-any
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true
- name: Verify versions
run: rustc --version && rustup --version && cargo --version
- name: Get current tag
id: current_tag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Release package
run: cargo publish --no-verify --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
- name: Release binaries
run: ./scripts/release_binaries.sh --version=${{ steps.current_tag.outputs.tag }}
- name: Release new version
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.current_tag.outputs.tag }}
name: Sonic ${{ steps.current_tag.outputs.tag }}
body: "⚠️ Changelog not yet provided."
files: ./${{ steps.current_tag.outputs.tag }}-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-packages:
needs: build-releases
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build packages
run: ./scripts/build_packages.sh
- name: Push packages to Packagecloud
uses: faucetsdn/action-packagecloud-upload-debian-packages@v1
with:
path: ./packages
repo: ${{ secrets.PACKAGECLOUD_REPO }}
token: ${{ secrets.PACKAGECLOUD_TOKEN }}
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU for cross-compilation
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Acquire Docker image metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: valeriansaliou/sonic
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
id: build
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
push: true