Skip to content

Commit

Permalink
Add: reusing workflow to upload to symbol server (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain authored Aug 30, 2023
1 parent f24e7ed commit e118783
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/rw-symbols-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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@v3
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ job:
- [Python - Black](.github/workflows/rw-py-black.yml): Runs "black" over the code.
- [Python - CodeQL](.github/workflows/rw-py-codeql.yml): Runs "CodeQL" over the code.
- [Python - Flake8](.github/workflows/rw-py-flake8.yml): Runs "flake8" over the code.
- [Symbols - upload](.github/workflows/rw-symbols-upload.yml): Upload the content of an artifact to the Symbol Server.

0 comments on commit e118783

Please sign in to comment.