Skip to content

Merge pull request #265 from orionrobots/dependabot/github_actions/tj… #317

Merge pull request #265 from orionrobots/dependabot/github_actions/tj…

Merge pull request #265 from orionrobots/dependabot/github_actions/tj… #317

name: Build, test and deploy
on:
push:
branches:
- master
- main
paths:
- '_posts/**'
- 'content/**'
- 'assets/**'
- 'src/**'
- 'index.md'
- '_includes/**'
- '_data/**'
- '_image_sources/**'
- 'galleries/**'
- 'navigation_and_indexes/**'
- 'products/**'
- '.github/workflows/on_push_to_master_test_and_deploy.yaml'
- '.github/workflows/on_call_build_site.yaml'
- '.github/workflows/on_call_staging_test.yaml'
- 'package.json'
- 'package-lock.json'
- 'webpack.config.js'
- 'favicon.png'
- '.eleventy.*'
- '_config.yml'
- 'google*.html'
- 'ads.txt'
concurrency:
group: site_building
cancel-in-progress: true
jobs:
build_site:
uses: ./.github/workflows/on_call_build_site.yaml
with:
push_tag: "latest"
staging_test:
uses: ./.github/workflows/on_call_staging_test.yaml
needs: build_site
deploy:
concurrency: live_environment
runs-on: ubuntu-latest
needs: staging_test
steps:
- name: Fetch site artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: _site
- name: extract site artifact
run: |
tar -xzf _site.tar.gz
- name: Fetch httpd conf artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: httpd.conf
path: .github/scripts/staging/httpd.conf
# Sync the files
- name: Sync the site over
uses: burnett01/rsync-deployments@3cccb6851148e6198ed9ed89eb0d1c17b5e58cc7 # v7.0.2
with:
switches: -a
path: _site/
remote_path: public_html
remote_host: home738752777.1and1-data.host
remote_user: ${{ secrets.ORIONROBOTS_DEPLOY_USER }}
remote_key: ${{ secrets.ORIONROBOTS_DEPLOY_KEY }}
# Checks
- name: Check if the site is up
run: |
curl -I -L -f https://orionrobots.co.uk/
curl -I -L -f https://orionrobots.co.uk/construction_guide.html
curl -I -L -f https://orionrobots.co.uk/wiki/lego
deploy_oauth_config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check for workflow changes
# tj-actions/changed-files v44.5.7
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c
id: filter
with:
files: |
.github/workflows/**
# see https://github.com/mcdeck/netlify-cms-oauth-provider-php
- name: Checkout the netlify-cms-oauth-provider-php
uses: actions/checkout@v5
with:
repository: mcdeck/netlify-cms-oauth-provider-php
path: netlify-cms-oauth-provider-php
- name: Perform the netlify composer install
if: steps.filter.outputs.any_changed == 'true'
run: |
cd netlify-cms-oauth-provider-php
composer install
- name: Copy over the netlify-cms-oauth-provider-php files
if: steps.filter.outputs.any_changed == 'true'
uses: burnett01/rsync-deployments@3cccb6851148e6198ed9ed89eb0d1c17b5e58cc7 # v7.0.2
with:
switches: -a
path: netlify-cms-oauth-provider-php/
remote_path: github-oauth2
remote_host: home738752777.1and1-data.host
remote_user: ${{ secrets.ORIONROBOTS_DEPLOY_USER }}
remote_key: ${{ secrets.ORIONROBOTS_DEPLOY_KEY }}
- name: Create the oauth environment file
if: steps.filter.outputs.any_changed == 'true'
run: |
(
echo "OAUTH_CLIENT_ID=${{ secrets.ORIONROBOTS_OAUTH_CLIENT_ID }}"
echo "OAUTH_CLIENT_SECRET=${{ secrets.ORIONROBOTS_OAUTH_CLIENT_SECRET }}"
echo "REDIRECT_URI=https://github-oauth2.orionrobots.co.uk/callback"
echo "ORIGIN=https://orionrobots.co.uk"
echo "APP_ENV=prod"
) > netlify-cms-oauth-provider-php/.env.local
- name: Copy over the oauth environment file
if: steps.filter.outputs.any_changed == 'true'
uses: burnett01/rsync-deployments@3cccb6851148e6198ed9ed89eb0d1c17b5e58cc7 # v7.0.2
with:
switches: -a
path: netlify-cms-oauth-provider-php/.env.local
remote_path: github-oauth2/.env.local
remote_host: home738752777.1and1-data.host
remote_user: ${{ secrets.ORIONROBOTS_DEPLOY_USER }}
remote_key: ${{ secrets.ORIONROBOTS_DEPLOY_KEY }}