Skip to content

Commit

Permalink
combine ci scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzhi713 committed Apr 27, 2022
1 parent 5b9ed7c commit 6d55152
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 45 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ jobs:
node-version: '16'
- name: Build
run: |
echo "dev.plannable.org" > public/CNAME
. ./scripts/ci_common.sh
npx electron-builder --linux
echo "dev.plannable.org" > public/CNAME
. ./scripts/pre_deploy.sh
- name: dev deploy 🚀
uses: JamesIves/[email protected]
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
run: |
. ./scripts/ci_common.sh
npx electron-builder --linux
. ./scripts/pre_deploy.sh
- name: dev deploy 🚀
uses: JamesIves/[email protected]
with:
Expand Down
26 changes: 5 additions & 21 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
# Scripts

The scripts in this directory are used to deploy our website on both our primary address (https://plannable.org) and our mirror (https://plannable.gitee.io) in China. To operate such a mirror, we basically have to mirror the resources that are located in the U.S., among which the two important ones are the website itself and the course catalog. Normally, there is no need for you to understand or modify these scripts, nor should you execute them directly.
The scripts in this directory are used to deploy our website to our primary address (https://plannable.org) and our development website (https://dev.plannable.org). Normally, there is no need for you to understand or modify these scripts, nor should you execute them directly.

If you want to update the data in scripts, make sure that you're in the project root, and run `npm run updatedata`.
If you want to update the data folder in scripts, make sure that you're in the project root, and run `npm run updatedata`.

## File Descriptions

### deploy.sh
### ci_common.sh

This file gets executed by the Travis CI when we push new commit to the repository. It will run tests, compile our website, and build documentation. Moreover, if the new commit is on the master branch, it will push the website and documentation built to [awesome-schedule.github.io](https://github.com/awesome-schedule/awesome-schedule.github.io) repository.
This file gets executed by GitHub Action when we push new commit to the repository. It will run tests, compile our website, and build documentation. Moreover, if the new commit is on the dev branch, it will deploy the website to https://dev.plannable.org. If new commit is on the master branch, it will deploy the website to https://plannable.org.

### data_loader.ts

The data loader can update the catalog of the latest 5 semesters by simply downloading the `csv` files from Lou's list, and it executes [auto_update.sh](./auto_update.sh) once per hour.
The data loader can update the catalog of the latest 5 semesters by simply downloading the `csv` files from Lou's list, and it executes [auto_update.sh](./auto_update.sh) once per hour to push data to https://github.com/awesome-schedule/data.

It will also download the index page of Lou's list for getting the list of semesters.

### auto_update.sh

The execution of this file requires push access to https://github.com/awesome-schedule/data and https://gitee.com/plannable/plannable.

This is a bash script that does the following

1. pull the latest website built from the [awesome-schedule.github.io](https://github.com/awesome-schedule/awesome-schedule.github.io) repository.
2. Remove the existing `.git` directory in `data` and initialize a git repo
3. stage, commit all files and force-push to https://github.com/awesome-schedule/data
4. create an empty directory called `deploy`
5. copy `data` and `awesome-schedule.github.io` into deploy
6. initialize a git repo in deploy
7. stage, commit all files and force-push to https://gitee.com/plannable/plannable, which is the repository for the website in China

The reason for force-push is that the data files are large and it may be inappropriate to keep the file history, as it will grow fairly quickly. However, this may change in the future.
10 changes: 9 additions & 1 deletion scripts/ci_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ cd ..

npm run test
npm run build
npm run tsdoc
npm run tsdoc

# copy some config files for github pages
cp public/.gitattributes dist/
cp public/.nojekyll dist/
cp public/CNAME dist/

mkdir dist/docs
cp -rf docs/tsdoc dist/docs/
12 changes: 0 additions & 12 deletions scripts/meta_data.ts

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/pre_deploy.sh

This file was deleted.

0 comments on commit 6d55152

Please sign in to comment.