forked from spaceapi-community/spaceapi-rs
-
Notifications
You must be signed in to change notification settings - Fork 3
165 lines (153 loc) · 5.73 KB
/
release.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Publish release
on:
push:
branches-ignore:
- '*'
tags:
- '*'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release on GitHub
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
binaries:
name: Build binaries
needs: release
strategy:
matrix:
include:
- arch: aarch64
rust_target: aarch64-unknown-linux-musl
packages: gcc-aarch64-linux-gnu musl-tools
- arch: armv6
rust_target: arm-unknown-linux-musleabihf
packages: gcc-arm-linux-gnueabihf musl-tools
- arch: armv7
rust_target: armv7-unknown-linux-musleabihf
packages: gcc-arm-linux-gnueabihf musl-tools
- arch: x86_64
rust_target: x86_64-unknown-linux-musl
packages: musl-tools
runs-on: ubuntu-latest
container: rust:1.75
steps:
- uses: actions/checkout@v2
- name: Cargo build
run: |
export DEBCONF_FRONTEND=noninteractive
apt-get update
apt-get upgrade --yes
apt-get install --yes ${{ matrix.packages }}
cargo build --bins --target "${{ matrix.rust_target }}" --release
cd "target/${{ matrix.rust_target }}/release"
sha256sum spaceapi-dezentrale-client >spaceapi-dezentrale-client.sha256
sha256sum spaceapi-dezentrale-server >spaceapi-dezentrale-server.sha256
- name: Append client binary to release page
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: spaceapi-dezentrale-client-${{ matrix.arch }}
asset_path: target/${{ matrix.rust_target }}/release/spaceapi-dezentrale-client
asset_content_type: application/x-executable
- name: Append client binary checksum to release page
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: spaceapi-dezentrale-client-${{ matrix.arch }}.sha256
asset_path: target/${{ matrix.rust_target }}/release/spaceapi-dezentrale-client.sha256
asset_content_type: text/plain
- name: Append server binary to release page
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: spaceapi-dezentrale-server-${{ matrix.arch }}
asset_path: target/${{ matrix.rust_target }}/release/spaceapi-dezentrale-server
asset_content_type: application/x-executable
- name: Append server binary checksum to release page
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: spaceapi-dezentrale-server-${{ matrix.arch }}.sha256
asset_path: target/${{ matrix.rust_target }}/release/spaceapi-dezentrale-server.sha256
asset_content_type: text/plain
container:
name: Build images
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: aarch64
rust_target: aarch64-unknown-linux-musl
docker_platform: linux/arm64
project: client
- arch: aarch64
rust_target: aarch64-unknown-linux-musl
docker_platform: linux/arm64
project: server
- arch: armv6
rust_target: arm-unknown-linux-musleabihf
docker_platform: linux/arm/v6
project: client
- arch: armv6
rust_target: arm-unknown-linux-musleabihf
docker_platform: linux/arm/v6
project: server
- arch: armv7
rust_target: armv7-unknown-linux-musleabihf
docker_platform: linux/arm/v7
project: client
- arch: armv7
rust_target: armv7-unknown-linux-musleabihf
docker_platform: linux/arm/v7
project: server
- arch: x86_64
rust_target: x86_64-unknown-linux-musl
docker_platform: linux/amd64
project: client
- arch: x86_64
rust_target: x86_64-unknown-linux-musl
docker_platform: linux/amd64
project: server
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to docker hub
uses: docker/build-push-action@v4
with:
context: .
build-args: TARGET=${{ matrix.rust_target }}
platforms: ${{ matrix.docker_platform }}
file: docker/Dockerfile.${{ matrix.project }}
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/spaceapi-dezentrale-${{ matrix.project }}:${{ matrix.arch }}
${{ secrets.DOCKERHUB_USERNAME }}/spaceapi-dezentrale-${{ matrix.project }}:${{ github.ref_name }}-${{ matrix.arch }}