-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (36 loc) · 1.13 KB
/
ci.yml
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
name: ci
on:
push:
branches:
- '*'
- '!latest'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Pull sources
uses: actions/checkout@v1
- name: Configure Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
- name: Publish
if: github.event.ref == 'refs/heads/master'
run: |
remote_branch=latest
git checkout --orphan "$remote_branch"
git config user.name "$GITHUB_ACTOR"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote rm origin || true
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git remote add origin "$remote_repo"
git add --all --force *
COMMIT_MESSAGE="Automated deployment: $(date -u) $GITHUB_SHA"
git commit -m "$COMMIT_MESSAGE" | true
git push origin "$remote_branch" --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}