-
Notifications
You must be signed in to change notification settings - Fork 91
149 lines (118 loc) · 4.07 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
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: Deploy
on:
push:
branches:
- master
# Run actions on PRs, but only deploy on master
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
cargo_docs:
name: Cargo Docs
runs-on: ubuntu-latest
steps:
- name: Install libcurl-dev
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --component rust-docs --no-self-update
- uses: swatinem/rust-cache@v2
with:
key: ${{ github.job }}
- name: Build Docs
run: cargo doc --workspace --all-features --no-deps
env:
RUSTDOCFLAGS: -Dwarnings
- run: echo '<meta http-equiv="refresh" content="0; url=relay/" />Redirecting to <a href="relay/">relay</a>' > target/doc/index.html
- name: Deploy
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/doc
event_schema:
name: Event Schema
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- uses: swatinem/rust-cache@v2
with:
key: ${{ github.job }}
- name: Generate Schema
run: cargo run -p generate-schema -- -o event.schema.json
- name: Deploy
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.DATA_SCHEMAS_GITHUB_TOKEN }}
run: |
git config --global user.name "$(git log -1 --pretty=format:%an $GITHUB_SHA)"
git config --global user.email "$(git log -1 --pretty=format:%ae $GITHUB_SHA)"
git clone https://getsentry-bot:$GITHUB_TOKEN@github.com/getsentry/sentry-data-schemas
cd sentry-data-schemas/
mkdir -p ./relay/
mv ../event.schema.json relay/event.schema.json
git add relay/event.schema.json
echo "attempting commit"
if ! git commit -m "getsentry/relay@$GITHUB_SHA" ; then
echo "Stopping, no changes"
exit 0
fi
for i in 1 2 3 4 5; do
echo "git push; Attempt $i"
if git push; then
exit 0
fi
git pull --rebase
done
echo "Failed to push"
exit 1
metrics_docs:
name: Metrics Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- uses: swatinem/rust-cache@v2
with:
key: ${{ github.job }}
- name: Document Metrics
run: cargo run -p document-metrics -- -o relay_metrics.json
relay-kafka/src/statsd.rs
relay-metrics/src/statsd.rs
relay-server/src/statsd.rs
relay-system/src/statsd.rs
- name: Deploy
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.DATA_SCHEMAS_GITHUB_TOKEN }}
run: |
git config --global user.name "$(git log -1 --pretty=format:%an $GITHUB_SHA)"
git config --global user.email "$(git log -1 --pretty=format:%ae $GITHUB_SHA)"
git clone https://getsentry-bot:$GITHUB_TOKEN@github.com/getsentry/sentry-docs
cd sentry-docs/
mv ../relay_metrics.json src/data/relay_metrics.json
git add src/data/relay_metrics.json
echo "attempting commit"
if ! git commit -m "getsentry/relay@$GITHUB_SHA" ; then
echo "Stopping, no changes"
exit 0
fi
for i in 1 2 3 4 5; do
echo "git push; Attempt $i"
if git push; then
exit 0
fi
git pull --rebase
done
echo "Failed to push"
exit 1