-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (55 loc) · 1.7 KB
/
rw-symbols-upload.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
name: Symbols Upload
# Upload the content of an artifact to the symbol server.
on:
workflow_call:
inputs:
artifact-name:
description: The name of the artifact to download.
required: true
type: string
repository:
description: The repository (without owner) doing the uploading.
required: true
type: string
secrets:
SYMBOLS_SIGNING_KEY:
description: The signing key for the Symbol server.
required: true
jobs:
symbols_upload:
runs-on: ubuntu-latest
name: Symbols upload
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: artifact
- name: Install mimetype
shell: bash
run: |
sudo apt update
sudo apt install -y libfile-mimeinfo-perl --no-install-recommends
- name: Publish
env:
SYMBOLS_SIGNING_KEY: ${{ secrets.SYMBOLS_SIGNING_KEY }}
shell: bash
run: |
echo "${SYMBOLS_SIGNING_KEY}" > symbols_signing_key.pem
cd artifact
for i in $(find -type f | cut -b 3-); do
echo "Uploading ${i} ..."
FILENAME="${i}"
SIGNATURE=$(echo -n "${FILENAME}" | openssl dgst -sha256 -sign ../symbols_signing_key.pem | base64 -w0)
CONTENT_TYPE=$(mimetype -b ${i})
curl \
-s \
--fail \
-X PUT \
-T ${i} \
-H "Content-Type: ${CONTENT_TYPE}" \
-H "X-Signature: ${SIGNATURE}" \
-H "X-Repository: ${{ inputs.repository }}" \
-H "User-Agent: symbols-upload/1.0" \
https://symbols.openttd.org/${FILENAME}
done