Skip to content

Commit 42eeab4

Browse files
Merge pull request #839 from deriv-com/master
update remote config branch
2 parents 9e275a7 + 5a86b33 commit 42eeab4

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Remote Config Backup Download
2+
description: Download remote config backup
3+
inputs:
4+
REMOTE_CONFIG_URL:
5+
description: "Remote config backup URL"
6+
runs:
7+
using: composite
8+
steps:
9+
- name: Download remote config backup
10+
env:
11+
REMOTE_CONFIG_URL: ${{ inputs.REMOTE_CONFIG_URL }}
12+
run: |
13+
echo "Downloading remote config backup"
14+
curl $REMOTE_CONFIG_URL > src/javascript/_common/remote_config.json
15+
echo "Remote Config backup downloaded successfully!"
16+
shell: bash
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Deriv App Remote Config backup file
2+
3+
permissions:
4+
actions: write
5+
checks: write
6+
contents: write
7+
deployments: write
8+
pull-requests: write
9+
statuses: write
10+
on:
11+
push:
12+
branches:
13+
- master
14+
15+
jobs:
16+
download_remote_config_backup_and_create_pr:
17+
name: Download Remote Config Backup File and Create PR
18+
runs-on: ubuntu-latest
19+
environment: Staging
20+
env:
21+
REMOTE_CONFIG_BRANCH: "remote_config_update_branch"
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
25+
- name: Import GPG key
26+
id: import-gpg
27+
uses: deriv-com/ghaction-import-gpg@v6
28+
with:
29+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
30+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
31+
git_user_signingkey: true
32+
git_commit_gpgsign: true
33+
- name: Checkout to remote_config_update_branch
34+
run: |
35+
git fetch origin
36+
git checkout "$REMOTE_CONFIG_BRANCH" || git checkout -b "$REMOTE_CONFIG_BRANCH" origin/"$REMOTE_CONFIG_BRANCH"
37+
shell: bash
38+
- name: Download Remote Config Backup File
39+
uses: .github/actions/download_remote_config_backup
40+
with:
41+
REMOTE_CONFIG_URL: ${{ vars.REMOTE_CONFIG_URL }}
42+
43+
- name: Commit the file and Create PR
44+
env:
45+
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
46+
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
47+
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
48+
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
49+
run: |
50+
if [ -z "$(git status --porcelain)" ]; then
51+
echo "No changes to commit, Not creating a PR."
52+
else
53+
echo "Changes detected, creating a PR"
54+
55+
# Commit the newly downloaded file
56+
cd $(git rev-parse --show-toplevel)
57+
git add packages/api/src/remote_config.json
58+
git commit -m "🤖 Remote Config file update 🤖"
59+
60+
# Force push to this branch in case a previous run created it.
61+
git push --set-upstream origin "$REMOTE_CONFIG_BRANCH" -f
62+
63+
sudo apt install gh
64+
gh auth login --with-token <<< ${{ github.token }}
65+
gh pr close "$REMOTE_CONFIG_BRANCH" || true
66+
gh pr create --base "master" --title "Sync Remote Config File 🤖" --head "deriv-com:$REMOTE_CONFIG_BRANCH" --body "This is an automated Pull Request designed to synchronize our project's Remote Config from Its origin. It checks for the changes in the remote config URL and in case of any change, it will update it using this PR."
67+
fi
68+
shell: bash

0 commit comments

Comments
 (0)