-
Notifications
You must be signed in to change notification settings - Fork 5
78 lines (76 loc) · 3.4 KB
/
compile.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
on:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
name: compile
jobs:
build:
name: Linux Build
runs-on: ubuntu-latest
steps:
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-linux-musl
override: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target aarch64-unknown-linux-musl
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target x86_64-unknown-linux-musl
- uses: docker/setup-buildx-action@v1
id: buildx
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
run: |
cp target/x86_64-unknown-linux-musl/release/easypwned easypwned
cp target/x86_64-unknown-linux-musl/release/easypwned_haveibeenpwned_downloader easypwned_haveibeenpwned_downloader
docker buildx build --platform linux/amd64 -t easybill/easypwned:latest_amd64 --push .
cp target/aarch64-unknown-linux-musl/release/easypwned easypwned
cp target/aarch64-unknown-linux-musl/release/easypwned_haveibeenpwned_downloader easypwned_haveibeenpwned_downloader
docker buildx build --platform linux/arm64 -t easybill/easypwned:latest_arm64 --push .
docker manifest create easybill/easypwned:latest easybill/easypwned:latest_amd64 easybill/easypwned:latest_arm64
docker manifest push easybill/easypwned:latest
- name: Build and push release
if: startsWith(github.ref, 'refs/tags/')
run: |
docker manifest create easybill/easypwned:${{ steps.vars.outputs.tag }} easybill/easypwned:latest_amd64 easybill/easypwned:latest_arm64
docker manifest push easybill/easypwned:${{ steps.vars.outputs.tag }}
- name: Release Build
if: startsWith(github.ref, 'refs/tags/')
run: |
cp target/aarch64-unknown-linux-musl/release/easypwned easypwned_${{ steps.vars.outputs.tag }}_linux_aarch64
cp target/aarch64-unknown-linux-musl/release/easypwned_haveibeenpwned_downloader easypwned_haveibeenpwned_downloader_${{ steps.vars.outputs.tag }}_linux_aarch64
cp target/x86_64-unknown-linux-musl/release/easypwned easypwned_${{ steps.vars.outputs.tag }}_linux_x86_64
cp target/x86_64-unknown-linux-musl/release/easypwned_haveibeenpwned_downloader easypwned_haveibeenpwned_downloader_${{ steps.vars.outputs.tag }}_linux_x86_64
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
easypwned_${{ steps.vars.outputs.tag }}_linux_aarch64
easypwned_haveibeenpwned_downloader_${{ steps.vars.outputs.tag }}_linux_aarch64
easypwned_${{ steps.vars.outputs.tag }}_linux_x86_64
easypwned_haveibeenpwned_downloader_${{ steps.vars.outputs.tag }}_linux_x86_64