Skip to content

Commit

Permalink
Migrated to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vania-pooh committed Oct 30, 2020
1 parent ae1caa1 commit 0d8b82e
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 47 deletions.
41 changes: 0 additions & 41 deletions .drone.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build

on:
pull_request:
push:
branches:
- master

jobs:
website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: npm install

- name: Build
run: npm run build
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: release

on:
release:
types: [published]

jobs:
website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: npm install

- name: Build
run: npm run build

- name: Deploy
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: ./deploy.sh
11 changes: 5 additions & 6 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash

WD=$(pwd)
CLONE_DIR="/go/website"
git clone https://${GITHUB_TOKEN}@github.com/aerokube/selenoid.git ${CLONE_DIR}
CLONE_DIR="${GITHUB_WORKSPACE}/selenoid"
git clone -b gh-pages https://${GITHUB_TOKEN}@github.com/aerokube/selenoid.git ${CLONE_DIR}
cd ${CLONE_DIR}
git config user.name ${DRONE_COMMIT_AUTHOR}
git config user.email ${DRONE_COMMIT_AUTHOR_EMAIL}
git checkout gh-pages
git config user.name "${GITHUB_REPOSITORY}"
git config user.email "[email protected]"
git rm ${CLONE_DIR}/main.*.css
git rm ${CLONE_DIR}/main.*.js
cp -R ${WD}/dist/* ${CLONE_DIR}
git add --all
git commit -am "Updated by ${DRONE_COMMIT_AUTHOR}"
git commit -am "Updated website"
git push origin HEAD:gh-pages

0 comments on commit 0d8b82e

Please sign in to comment.