-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (83 loc) · 2.69 KB
/
deploy.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
name: deploy
on:
push:
tags:
- "*.*.*"
jobs:
build_binary:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: "Build yevis binary (x86_64)"
run: docker run --rm -v "$(pwd)":/home/rust/src messense/rust-musl-cross:x86_64-musl cargo build --release --target x86_64-unknown-linux-musl
- name: "Build yevis binary (arm64)"
run: docker run --rm -v "$(pwd)":/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release --target aarch64-unknown-linux-musl
- name: "Upload yevis binary (x86_64)"
uses: actions/upload-artifact@v3
with:
name: yevis_x86_64
path: target/x86_64-unknown-linux-musl/release/yevis
- name: "Upload yevis binary (arm64)"
uses: actions/upload-artifact@v3
with:
name: yevis_arm64
path: target/aarch64-unknown-linux-musl/release/yevis
create_release:
needs: [build_binary]
runs-on: ubuntu-latest
steps:
- name: "Download yevis binary (x86_64)"
uses: actions/download-artifact@v3
with:
name: yevis_x86_64
path: ./x86_64
- name: "Download yevis binary (arm64)"
uses: actions/download-artifact@v3
with:
name: yevis_arm64
path: ./arm64
- name: "Rename binaries"
run: |
mv ./x86_64/yevis ./yevis_x86_64
mv ./arm64/yevis ./yevis_arm64
- name: "Release"
run: |
gh release \
--repo ${{ github.repository }} \
create ${{ github.ref_name }} \
--title ${{ github.ref_name }} \
--generate-notes \
yevis_x86_64 \
yevis_arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy_ghcr:
needs: [create_release]
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v2
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and push"
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/yevis-cli:${{ github.ref_name }}
ghcr.io/${{ github.repository_owner }}/yevis-cli:latest