-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathscripts.ts
65 lines (55 loc) · 1.53 KB
/
scripts.ts
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
// Setup the git config.
export const SETUP_GIT_CONFIG = `
git config --global user.email {GIT_AUTHOR_EMAIL}
git config --global user.name {GIT_AUTHOR_NAME}
git config --global init.defaultBranch main
`;
// Make a new directory.
export const MAKE_PROJECT_DIR = `
cd ~
mkdir {REPO_NAME}
cd {REPO_NAME}
`;
// Run the build script and change to the script's final directory.
export const RUN_BUILD_SCRIPT = `
source /app/build.sh > /app/build.log 2>&1
`;
// Change to the top-level directory of the git repository.
export const CD_GIT_ROOT = `
cd $(git rev-parse --show-toplevel)
`
export const GET_BUILD_LOG = `
cat /app/build.log
`
// Configure the git credentials.
export const SETUP_GIT_CREDENTIALS = `
echo "https://{GITHUB_USERNAME}:{GITHUB_TOKEN}@github.com" >> ~/.git-credentials
git config --global credential.helper store
`
// Push the main branch to the remote repository.
export const PUSH_TO_REPO = `
git branch -M main
git remote add origin {PUSH_URL}
git push -u origin main
`
// Clone an existing repository.
export const CLONE_PROJECT_REPO = `
cd ~
git clone https://{GITHUB_USERNAME}:{GITHUB_TOKEN}@github.com/{FULL_REPO_NAME}.git
cd {REPO_NAME}
`
// Get the contents of the repository.
export const GET_FILE_LIST = `
cd ~/{REPO_NAME}
find . -path "./.git" -prune -o -type f -print
`
// Create a new git branch.
export const CREATE_NEW_BRANCH = `
cd ~/{REPO_NAME}
git checkout {SOURCE_BRANCH_NAME}
git checkout -b {BRANCH_NAME}
`
// Push the new branch to the remote repository.
export const PUSH_BRANCH = `
git push -u origin {BRANCH_NAME}
`