Skip to content

Commit e208d74

Browse files
authored
Merge pull request #319 from MoveOnOrg/remove-travis
Migrate auto-deploy from travis to GH workflow
2 parents 77859a8 + 0797798 commit e208d74

10 files changed

Lines changed: 14071 additions & 82 deletions

File tree

.github/workflows/build-check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build Check
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up NodeJS
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: '10'
17+
cache: 'npm'
18+
19+
- name: Setup Python (for node-gyp)
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Build
28+
run: npm run compile

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy to S3
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '10'
19+
cache: 'npm'
20+
21+
- name: Setup Python (for node-gyp)
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build
30+
run: npm run compile
31+
32+
- name: Prepare deployment files
33+
run: |
34+
cp -r public/images deploy/
35+
cp -r public/scripts deploy/
36+
cp -r public/styles deploy/
37+
cp -r public/styleguide deploy/
38+
cp public/*.html deploy/
39+
40+
- name: Configure AWS credentials
41+
uses: aws-actions/configure-aws-credentials@v4
42+
with:
43+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
44+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
45+
aws-region: us-east-2
46+
- name: Deploy to S3 (giraffe)
47+
run: |
48+
aws s3 sync deploy/ s3://static.moveon.org/giraffe \
49+
--acl public-read \
50+
--cache-control "max-age=31536000"
51+
52+
- name: Deploy to S3 (giraffe-staging)
53+
run: |
54+
aws s3 sync deploy/ s3://static.moveon.org/giraffe-staging \
55+
--acl public-read

.github/workflows/npm-gulp.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/node_modules
22
/public
33
/package
4-
/package-lock.json
54
deploy
65
*~
76
.#*

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v10.18.0
1+
v10

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
# Contributing
22

3-
## Development Requirements
4-
- Node v7.10.1 and above
5-
- NPM
6-
- Gulp, installed globally
7-
8-
93
## Local Setup
104

115
- Clone this repository.
12-
- Install node dependencies: `npm install`
6+
- [Install nvm if you haven't previously used it](https://github.com/nvm-sh/nvm#installing-and-updating)
7+
- Install/set NodeJS version: `nvm install`
8+
- Install node dependencies: `npm ci`
139
- Edit .env to set `ENV=LOCAL`
14-
- Run `gulp watch` to boot up local development server and build tools. Normally this would boot up `localhost:3000`, or whichever port is available.
10+
- Run `npm run watch` to boot up local development server and build tools. Normally this would boot up `localhost:3000`, or whichever port is available.
1511
- Get some coffee. Shake up. Start coding :).
1612

1713
## Build
1814

19-
Run `gulp` to compile all the source files into the `public` folder.
15+
Run `npm run compile` to compile all the source files into the `public` folder.
2016

21-
Run `yarn zip` to create a compressed zip file. This is saved as `moveon.zip` in the `public` folder.
17+
Run `npm run zip` to create a compressed zip file. This is saved as `moveon.zip` in the `public` folder.
2218

2319

2420
## Files and Directories
@@ -30,7 +26,7 @@ The local server files are located inside the `public` folder.
3026

3127
### Templates
3228

33-
Templates are **twig** files compiled into html through `gulp pages`. They are located in `src/templates`.
29+
Templates are **twig** files compiled into html through `npx gulp pages`. They are located in `src/templates`.
3430

3531
For Twig templating guides, please refer to their [site](https://twig.symfony.com/doc/2.x/templates.html).
3632

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ For development please read **CONTRIBUTING.md**.
2020

2121
Deploy CSS, JS, images and fonts to AWS S3 (for MoveOn devs)
2222

23-
Updating `main` branch and pushing to github with ENV=production (in .env) triggers AWS S3 autodeploy via Travis. Minified assets are copied from public/fonts, public/images, public/scripts and public/styles into the `deploy` directory and then pushed to https://static.moveon.org/giraffe/. See `.travis.yml` for details.
23+
Merging a PR into the remote GitHub repo's `main` branch with ENV=production (in `.env`) triggers AWS S3 auto-deploy via a GitHub Workflow. Minified assets are copied from public/fonts, public/images, public/scripts and public/styles into the `deploy` directory and then pushed to https://static.moveon.org/giraffe/. See `.github/workflows/deploy.yml` for details.
2424

25-
To generate a new encrypted secret_access_key, install the travis command line tool https://github.com/travis-ci/travis.rb#installation and then run the `travis encrypt` command in https://docs.travis-ci.com/user/deployment/s3/ using the credentials for an aws user with write access to the proper s3 bucket. Be sure to lint your updated config with `travis lint .travis.yml`!
25+
Secrets used in workflows are stored in [the GitHub repo's repository secrets](https://github.com/MoveOnOrg/giraffe/settings/secrets/actions).
2626

2727
### Uglify and minify assets
2828

0 commit comments

Comments
 (0)