Repository navigation
39 lines (36 loc) · 2.1 KB
/
Copy pathencrypted-blub.yml
File metadata and controls
39 lines (36 loc) · 2.1 KB
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
name: Write encrypted blub on the RPM host
on: workflow_dispatch
permissions:
contents: read
jobs:
write:
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check out the script
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Encrypt blub on the runner
run: |
archive="$RUNNER_TEMP/age.tar.gz"
curl --fail --silent --show-error --location --retry 3 \
https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-amd64.tar.gz -o "$archive"
printf '%s %s\n' bdc69c09cbdd6cf8b1f333d372a1f58247b3a33146406333e30c0f26e8f51377 "$archive" | sha256sum --check --status
tar -xzf "$archive" -C "$RUNNER_TEMP" age/age
umask 077
PATH="$RUNNER_TEMP/age:$PATH" bin/write-encrypted-blub > "$RUNNER_TEMP/blub.age"
- name: Load the RPM SSH key
uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e # v0.8.0
with:
ssh-private-key: ${{ secrets.GITHUBRPMHENDERKESPRIVATEKEY }}
- name: Upload encrypted blub.txt
env:
RPM_SERVER: ${{ secrets.DEB_SERVER_IP }}
run: |
printf '%s %s\n' "${RPM_SERVER:?Missing RPM upload endpoint}" 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICaB5IjokRHAH0Y9pzVe/Jx3s6cn0OADJ9uTxQQubBMu' > "$RUNNER_TEMP/rpm-known-hosts"
rsync --ignore-times --perms --chmod=F600 \
--rsync-path='cd && test ! -L private && install -d -m 0700 private && exec rsync' \
-e "ssh -T -o BatchMode=yes -o ConnectTimeout=15 -o StrictHostKeyChecking=yes -o UserKnownHostsFile='$RUNNER_TEMP/rpm-known-hosts'" \
"$RUNNER_TEMP/blub.age" "github@$RPM_SERVER:private/blub.txt"