-
Notifications
You must be signed in to change notification settings - Fork 48
149 lines (119 loc) · 3.89 KB
/
cicd.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: CI and CD
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:
inputs:
should_publish:
description: "whether to publish the release (yes/no)"
required: true
default: "no"
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: "Run linters"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run linters
run: make lint
build-pam-module:
name: "Build PAM module"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Enable Rust cache
uses: Swatinem/rust-cache@v1
- name: Install libpam
run: sudo apt-get install libpam0g-dev
- name: Build
run: make clean build/pam_wsl_hello.so
- uses: actions/upload-artifact@v2
name: Upload artifact
with:
name: "PAM module"
path: build/pam_wsl_hello.so
if-no-files-found: error
build-windows-binary:
name: "Build Windows binary"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: make clean build/WindowsHelloBridge.exe
- uses: actions/upload-artifact@v2
name: Upload artifacts
with:
name: "Windows Binary"
path: build/WindowsHelloBridge.exe
if-no-files-found: error
release:
name: "Release"
runs-on: ubuntu-latest
needs: [build-pam-module, build-windows-binary]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: "Windows Binary"
path: build
- uses: actions/download-artifact@v2
with:
name: "PAM module"
path: build
- name: Conventional Changelog Action
if: ${{ github.event.inputs.should_publish == 'yes' }}
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
version-file: ./wsl_hello_pam/Cargo.toml,./win_hello_bridge/Cargo.toml
version-path: package.version
skip-on-empty: false
git-user-name: "github-actions[bot]"
git-user-email: "41898282+github-actions[bot]@users.noreply.github.com"
release-count: "0"
- name: Create Release asset
id: create_asset
env:
release_name: release
run: |
make -d release RELEASE="$release_name"
echo "::set-output name=release_asset::$release_name.tar.gz"
- uses: actions/upload-artifact@v2
if: ${{ github.event.inputs.should_publish != 'yes' }}
name: Upload the release asset (CI)
with:
name: ${{ steps.create_asset.outputs.release_asset }}
path: ${{ steps.create_asset.outputs.release_asset }}
if-no-files-found: error
- name: Create Release
if: ${{ github.event.inputs.should_publish == 'yes' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
- name: Upload Release Asset
if: ${{ github.event.inputs.should_publish == 'yes' }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.create_asset.outputs.release_asset }}
asset_name: ${{ steps.create_asset.outputs.release_asset }}
asset_content_type: application/gzip