-
Notifications
You must be signed in to change notification settings - Fork 5
103 lines (97 loc) · 3.89 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
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
on:
push:
tags:
- 'v*.*.*'
name: compile
jobs:
build:
name: Build
strategy:
fail-fast: true
matrix:
container:
- { os: 'ubuntu-latest', rust_target: 'aarch64-unknown-linux-musl' }
- { os: 'ubuntu-latest', rust_target: 'x86_64-unknown-linux-musl' }
- { os: 'macos-latest', rust_target: 'x86_64-apple-darwin' }
- { os: 'macos-latest', rust_target: 'aarch64-apple-darwin' }
runs-on: "${{ matrix.container.os }}"
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: "${{ matrix.container.rust_target }}"
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: "--release --target ${{ matrix.container.rust_target }}"
- name: Build and push
run: |
cp target/${{ matrix.container.rust_target }}/release/easypwned target/${{ matrix.container.rust_target }}/release/easypwned_${{ matrix.container.rust_target }}
cp target/${{ matrix.container.rust_target }}/release/easypwned_haveibeenpwned_downloader target/${{ matrix.container.rust_target }}/release/easypwned_haveibeenpwned_downloader_${{ matrix.container.rust_target }}
- name: Prepare output artifact (easypwned)
uses: actions/upload-artifact@v3
with:
name: easypwned-${{ matrix.container.rust_target }}
path: |
target/${{ matrix.container.rust_target }}/release/easypwned_${{ matrix.container.rust_target }}
target/${{ matrix.container.rust_target }}/release/easypwned_haveibeenpwned_downloader_${{ matrix.container.rust_target }}
release:
name: Release
runs-on: ubuntu-latest
needs: ["build"]
steps:
- name: download artifacts
uses: actions/download-artifact@v3
with:
path: binaries
- name: Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
binaries/*/*
docker_build:
name: docker
runs-on: ubuntu-latest
needs: ["build"]
strategy:
fail-fast: true
matrix:
container:
- { os: 'ubuntu-latest', arch: 'arm64', rust_target: 'aarch64-unknown-linux-musl' }
- { os: 'ubuntu-latest', arch: 'amd64', rust_target: 'x86_64-unknown-linux-musl' }
steps:
- 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: download artifacts
uses: actions/download-artifact@v3
with:
path: binaries
- name: Build and push
run: |
cp /binaries/easypwned-${{ matrix.container.rust_target }}/easypwned_${{ matrix.container.rust_target }} binary_easypwned
cp /binaries/easypwned-${{ matrix.container.rust_target }}/easypwned_haveibeenpwned_downloader_${{ matrix.container.rust_target }} binary_easypwned_haveibeenpwned_downloader
docker buildx build -o type=docker --platform linux/${{ matrix.container.arch }} -t easybill/easypwned:${{github.ref_name}}_${{ matrix.container.arch }} .
docker push easybill/easypwned:${{github.ref_name}}_${{ matrix.container.arch }}
docker_manifest:
name: Docker Image
runs-on: ubuntu-latest
needs: ["docker_build"]
steps:
- name: Build and Push manifest
run: |
docker manifest create easybill/easypwned:${{ steps.vars.outputs.tag }} easybill/easypwned:${{github.ref_name}}_amd64 easybill/easypwned:${{github.ref_name}}_arm64
docker manifest push easybill/easypwned:${{ steps.vars.outputs.tag }}