Skip to content

Commit 17a2f0a

Browse files
authored
Github Actions (#1267)
* Github Actions * set timeout * Test gh-pages * Add checkout to pages * Properly handle tags for pages * properly parse tag * lint yml * Only deploy docs on master and tags
1 parent c89eec6 commit 17a2f0a

File tree

5 files changed

+89
-57
lines changed

5 files changed

+89
-57
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: ci
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- '**'
9+
jobs:
10+
build:
11+
runs-on: ubuntu-18.04
12+
timeout-minutes: 30
13+
env:
14+
MONGODB_VERSION: 3.6.9
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: '10.14'
21+
- name: Cache Node.js modules
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.npm
25+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-node-
28+
- run: npm ci
29+
- run: npm install -g mongodb-runner
30+
- run: mongodb-runner start
31+
- run: npm run lint
32+
- run: npm test -- --maxWorkers=4
33+
- run: npm run integration
34+
env:
35+
CI: true
36+
- run: bash <(curl -s https://codecov.io/bash)

.github/workflows/pages.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: docs
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- '*'
8+
jobs:
9+
build:
10+
runs-on: ubuntu-18.04
11+
timeout-minutes: 30
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Use Node.js
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: '10.14'
18+
- name: Cache Node.js modules
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.npm
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-node-
25+
- name: Get Tag
26+
uses: actions/github-script@v3
27+
id: tag
28+
with:
29+
github-token: ${{secrets.GITHUB_TOKEN}}
30+
result-encoding: string
31+
script: |
32+
const ref = process.env.GITHUB_REF
33+
if(!ref.startsWith('refs/tags/'))
34+
return ''
35+
return ref.replace(/^refs\/tags\//, '')
36+
- name: Generate Docs
37+
run: |
38+
echo $SOURCE_TAG
39+
npm ci
40+
npm run release_docs
41+
env:
42+
SOURCE_TAG: ${{ steps.tag.outputs.result }}
43+
- name: Deploy
44+
uses: peaceiris/[email protected]
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
publish_dir: ./docs

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a href="https://twitter.com/intent/follow?screen_name=parseplatform"><img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/parseplatform?style=social&label=Follow"></a>
1313
<a href="https://community.parseplatform.org/"><img alt="Join the conversation" src="https://img.shields.io/discourse/https/community.parseplatform.org/topics.svg"></a>
1414
<a href="https://github.com/parse-community/Parse-SDK-JS/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/badge/license-BSD-lightgrey.svg"></a>
15-
<a href=" https://travis-ci.org/parse-community/Parse-SDK-JS"><img alt="Build status" src="https://travis-ci.org/parse-community/Parse-SDK-JS.svg?branch=master"></a>
15+
<a href="https://github.com/parse-community/Parse-SDK-JS/actions?query=workflow%3Aci+branch%3Amaster"><img alt="Build status" src="https://github.com/parse-community/Parse-SDK-JS/workflows/ci/badge.svg?branch=master"></a>
1616
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/parse-server/backers/badge.svg" /></a>
1717
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/parse-server/sponsors/badge.svg" /></a>
1818
</p>

release_docs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh -e
22
set -x
3-
if [ "${TRAVIS_REPO_SLUG}" = "" ];
3+
if [ "${GITHUB_ACTIONS}" = "" ];
44
then
5-
echo "Cannot release docs without TRAVIS_REPO_SLUG set"
5+
echo "Cannot release docs without GITHUB_ACTIONS set"
66
exit 0;
77
fi
8-
REPO="https://github.com/${TRAVIS_REPO_SLUG}"
8+
REPO="https://github.com/parse-community/Parse-SDK-JS"
99

1010
rm -rf docs
1111
git clone -b gh-pages --single-branch $REPO ./docs
@@ -15,9 +15,9 @@ cd ..
1515

1616
DEST="master"
1717

18-
if [ "${TRAVIS_TAG}" != "" ];
18+
if [ "${SOURCE_TAG}" != "" ];
1919
then
20-
DEST="${TRAVIS_TAG}"
20+
DEST="${SOURCE_TAG}"
2121
# change the default page to the latest
2222
echo "<meta http-equiv='refresh' content='0; url=/Parse-SDK-JS/api/${DEST}'>" > "docs/api/index.html"
2323
fi

0 commit comments

Comments
 (0)