Skip to content

Commit

Permalink
Introduce Github Actions (#671)
Browse files Browse the repository at this point in the history
* initial commit of assertions

* bump dependencies

* regenerate package-lock

* specify prettier version

* add version

* update lint commands

* try out slack notification

* initial commit of deploy action

* add slack notification to deployment

* rebuild

* tidy up deploy yml

* only run on PR to main

* update descriptions

* auth composer

* auth composer
  • Loading branch information
Greg Rickaby authored Jun 11, 2021
1 parent a81a1b2 commit 07dea55
Show file tree
Hide file tree
Showing 5 changed files with 1,987 additions and 1,529 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/assertions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Assertions

on:
pull_request:
branches: main

workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]
php-versions: ['7.4']

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ github.token }}

- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2, phpcs

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.OS }}-node-

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.OS }}-composer-

- name: Authorize Composer with WDS packagist server
run: echo '${{ secrets.COMPOSER_AUTH }}' > $GITHUB_WORKSPACE/auth.json

- name: Install dependencies
run: npm ci

- name: Lint PHP
run: npm run lint:php

- name: Lint scripts
run: npm run lint:js

- name: Lint styles
run: npm run lint:css

- name: Lint markdown
run: npm run lint:md:docs

- name: Lint package.json
run: npm run lint:pkg-json
75 changes: 75 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Deploy to wdunderscores.com

on:
push:
branches:
- main

workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]
php-versions: ['7.4']

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ github.token }}

- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.OS }}-node-

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.OS }}-composer-

- name: Authorize Composer with WDS packagist server
run: echo '${{ secrets.COMPOSER_AUTH }}' > $GITHUB_WORKSPACE/auth.json

- name: Install and build
run: npm ci

- name: Rsync to wdunderscores.com
uses: easingthemes/ssh-deploy@v2
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: '-v -a -z --delete'
SOURCE: './'
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_PATH }}
EXCLUDE: 'node_modules/, vendor/'

- name: Notify Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: wd_s-firehose
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.slack-edge.com/2020-11-25/1527503386626_319578f21381f9641cd8_192.png
SLACK_USERNAME: Github
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_FOOTER: ${{ github.repository }}
Loading

0 comments on commit 07dea55

Please sign in to comment.