-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.27 KB
/
take_screenshot.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
name: Take Screenshot
on:
push:
branches:
- main
paths:
- 'src/**'
- 'img/**'
- 'ui/**'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
DISPLAY: :99
RUST_LOG: debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-foo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libxkbcommon-x11-0
- name: Start Xvfb
run: Xvfb :99 -screen 0 1080x1900x24 &
- name: Build
run: cargo build --release --features selfie
- name: Run and take screenshot
run: |
cargo run --release --features selfie &
sleep 5
- name: Commit and push screenshot
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add foo.png
git commit -m "Add updated screenshot"
git push
- name: Upload screenshots as artifact
uses: actions/upload-artifact@v2
with:
name: screenshot
path: |
foo.png