-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (118 loc) · 3.79 KB
/
release.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
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
name: Release CI/CD
on:
push:
branches:
- main
tags:
- 'v0.1.2'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
file-extension: [""]
target:
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
platform: [ubuntu-20.04]
include:
- file-extension: .exe
target: x86_64-pc-windows-gnu
platform: ubuntu-20.04
runs-on: ${{ matrix.platform }}
timeout-minutes: 240 # Increase the timeout to 4 hours
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
# - name: Setup | Version
# id: get_version
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Setup | Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Build | Release
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target ${{ matrix.target }} --release
- name: Build | Rename with Target
run: cp target/${{ matrix.target }}/release/ruststrom${{ matrix.file-extension }} rust-strom-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}${{ matrix.file-extension }}
- name: Release | Upload Artifact
uses: actions/upload-artifact@v2
with:
name: rust-strom-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}${{ matrix.file-extension }}
path: rust-strom-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}${{ matrix.file-extension }}
build-docker:
runs-on: ubuntu-20.04
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: rust-strom/rust-strom-lb
tag-semver: |
{{version}}
{{major}}.{{minor}}
- name: Setup | QEMU
uses: docker/setup-qemu-action@v1
- name: Setup | Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Setup | Docker Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build | Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
release:
needs: [build, build-docker]
runs-on: ubuntu-20.04
steps:
- name: Release | Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Release | GitHub
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
name: ARLB ${{ github.ref }}
body: |
TODO
draft: true
prerelease: false
files: |
artifacts/**/*
- name: Release | Purge Artifacts
uses: kolpav/purge-artifacts-action@v1
with:
token: ${{ secrets.PERSONAL_TOKEN }}
expire-in: "0d"