Skip to content

Commit 23ed230

Browse files
committed
Add the decryption script.
1 parent 31989d0 commit 23ed230

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

.github/workflows/build-on-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
# This operation is specific to `gcloud-java` repository only.
2121
- name: Decrypt the credentials for the Spine-Dev service account
22-
run: ./config/scripts/decrypt.sh "$SPINE_DEV_KEY" ./.github/keys/spine-dev.json.gpg ./spine-dev.json
22+
run: ./scripts/decrypt.sh "$SPINE_DEV_KEY" ./.github/keys/spine-dev.json.gpg ./spine-dev.json
2323
env:
2424
SPINE_DEV_KEY: ${{ secrets.SPINE_DEV_KEY }}
2525

scripts/decrypt.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright 2022, TeamDev. All rights reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Redistribution and use in source and/or binary forms, with or without
13+
# modification, must retain the above copyright notice and the following
14+
# disclaimer.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
#
28+
29+
# Decrypts a file via `gpg`.
30+
#
31+
# Params:
32+
# 1. The secret passphrase used when encrypting the file.
33+
# 2. The encrypted file.
34+
# 3. The path where the decrypted file should go.
35+
#
36+
37+
if [ "$#" -ne 3 ]; then
38+
echo "Usage: decrypt.sh <passphrase> <encrypted file> <target file>"
39+
exit 1
40+
fi
41+
42+
gpg --quiet --batch --yes --decrypt --passphrase="$1" --output "$3" "$2"

0 commit comments

Comments
 (0)