This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
Post tweak for actions runner #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Sites | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
RUNNER_TOOL_CACHE: /toolcache | |
jobs: | |
files_changed: | |
name: Get changed files | |
runs-on: ubuntu-latest | |
outputs: | |
brandonb_ca: ${{ steps.changes.outputs.brandonb_ca }} | |
ve7tzb_ca: ${{ steps.changes.outputs.ve7tzb_ca }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
brandonb_ca: | |
- 'brandonb.ca/**' | |
ve7tzb_ca: | |
- 've7tzb.ca/**' | |
lint_and_test: | |
name: Lint and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install js dependencies | |
run: npm ci | |
- name: Run linting | |
run: npm run lint:nofix | |
build-brandonb_ca: | |
name: Build and Deploy brandonb.ca | |
runs-on: ubuntu-latest | |
needs: | |
- files_changed | |
- lint_and_test | |
if: ${{ needs.files_changed.outputs.brandonb_ca == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
id: get-awspublish-hash | |
with: | |
patterns: |- | |
**/.awspublish-brandonb-web-media | |
- uses: actions/cache@v4 | |
with: | |
path: .awspublish-brandonb-web-media | |
key: ${{ runner.os }}-awspublish-cache-${{ steps.get-awspublish-hash.outputs.hash }} | |
restore-keys: | | |
${{ runner.os }}-awspublish-cache- | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3' | |
bundler-cache: true | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install ruby dependencies | |
run: gem install bundler && bundle install | |
- name: Install js dependencies | |
run: npm ci | |
- name: Build and deploy | |
run: npm run brandonb.ca:deploy | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
FLICKR_CONSUMER_KEY: ${{ secrets.FLICKR_CONSUMER_KEY }} | |
FLICKR_CONSUMER_SECRET: ${{ secrets.FLICKR_CONSUMER_SECRET }} | |
FLICKR_OAUTH_TOKEN: ${{ secrets.FLICKR_OAUTH_TOKEN }} | |
FLICKR_OAUTH_TOKEN_SECRET: ${{ secrets.FLICKR_OAUTH_TOKEN_SECRET }} | |
- uses: sarisia/actions-status-discord@v1 | |
if: success() | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
description: "Successfully deployed brandonb.ca" | |
color: 0x28a745 | |
- uses: sarisia/actions-status-discord@v1 | |
if: failure() | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
description: "Failed to deploy brandonb.ca" | |
color: 0xdc3545 | |
build-ve7tzb_ca: | |
name: Build and Deploy ve7tzb.ca | |
runs-on: ubuntu-latest | |
needs: | |
- files_changed | |
- lint_and_test | |
if: ${{ needs.files_changed.outputs.ve7tzb_ca == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/[email protected] | |
id: get-awspublish-hash | |
with: | |
patterns: |- | |
**/.awspublish-brandonb-web-media | |
- uses: actions/cache@v4 | |
with: | |
path: .awspublish-brandonb-web-media | |
key: ${{ runner.os }}-awspublish-cache-${{ steps.get-awspublish-hash.outputs.hash }} | |
restore-keys: | | |
${{ runner.os }}-awspublish-cache- | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3' | |
bundler-cache: true | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install ruby dependencies | |
run: gem install bundler && bundle install | |
- name: Install js dependencies | |
run: npm ci | |
- name: Build and deploy | |
run: npm run ve7tzb.ca:deploy | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
- uses: sarisia/actions-status-discord@v1 | |
if: success() | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
description: "Successfully deployed ve7tzb.ca" | |
color: 0x28a745 | |
- uses: sarisia/actions-status-discord@v1 | |
if: failure() | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
description: "Failed to deploy ve7tzb.ca" | |
color: 0xdc3545 |