-
Notifications
You must be signed in to change notification settings - Fork 5
55 lines (50 loc) · 1.49 KB
/
build-and-package-rust-binary.yaml
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
name: Build and package Rust binary
on:
workflow_dispatch:
push:
branches: [ main ]
paths: [ 'rust/**' ]
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: ⚡ Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set up Rust
uses: ATiltedTree/setup-rust@v1.0.5
with:
rust-version: stable
- name: Build Rust binary
run: cd rust && cargo build --release --bin back-up-drive-folder --target-dir target
- uses: actions/upload-artifact@v3
with:
name: back-up-drive-folder
path: ./rust/target/release/back-up-drive-folder
build-and-push-docker-image:
runs-on: ubuntu-latest
needs: build-release
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: back-up-drive-folder
path: ./rust/target/release
- name: Make binary executable again
run: chmod 755 ./rust/target/release/back-up-drive-folder
- name: Build and publish Docker Images to GitHub Container registry
uses: VaultVulp/gp-docker-action@1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: g2s3
image-tag: latest
build-context: ./rust
dockerfile: ./rust/Dockerfile