Skip to content

Commit

Permalink
Merge pull request #57 from adobecom/stage
Browse files Browse the repository at this point in the history
[Release] Stage to Main
  • Loading branch information
JasonHowellSlavin authored Jun 21, 2024
2 parents e30fe7f + 20f6fef commit 247d5c1
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 13 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/fg-sync-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Floodgate Repo Sync

on:
workflow_dispatch:
inputs:
syncBranch:
description: 'Branch to sync'
required: true
default: 'stage'
type: choice
options:
- 'stage'
- 'main'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.FG_SYNC_APP_ID }}
private-key: ${{ secrets.FG_SYNC_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "bacom-blog-pink"

- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ inputs.syncBranch }}

- name: Clone Floodgate Repository and Checkout Selected Branch
run: |
git clone https://github.com/adobecom/bacom-blog-pink.git ../bacom-blog-pink
cd ../bacom-blog-pink
git checkout $FG_SYNC_BRANCH
echo "bacom-blog-pink branch"
git branch
cd ../bacom-blog
echo "bacom-blog branch"
git branch
env:
FG_SYNC_BRANCH: ${{ inputs.syncBranch }}

- name: Overwrite floodgate repo files with latest from source repo
run: |
rsync -av --exclude='fstab.yaml' --exclude='.github' --exclude='.kodiak' --exclude='.git' --exclude='.idea' --exclude='.husky' --exclude='.vscode' --exclude='tools/sidekick/config.json' ./ ../bacom-blog-pink/
- name: Commit and Push Changes to Floodgate Repository
run: |
cd ../bacom-blog-pink
echo "bacom-blog-pink branch"
git branch
git config user.email "$FG_SYNC_BOT_EMAIL"
git config user.name "$FG_SYNC_BOT_NAME"
git status
git remote set-url origin https://oauth2:[email protected]/adobecom/bacom-blog-pink.git
git remote -v
git add .
git commit -m "Syncing bacom-blog to bacom-blog-pink"
git push origin $FG_SYNC_BRANCH --force
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
FG_SYNC_BOT_EMAIL: ${{ secrets.FG_SYNC_BOT_EMAIL }}
FG_SYNC_BOT_NAME: ${{ secrets.FG_SYNC_BOT_NAME }}
FG_SYNC_BRANCH: ${{ inputs.syncBranch }}
17 changes: 8 additions & 9 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
name: Run tests
name: Unit Tests
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- main
types: [opened, synchronize, reopened]
jobs:
build:
run-tests:
name: Running tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -34,7 +33,7 @@ jobs:
run: xvfb-run -a npm test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
8 changes: 8 additions & 0 deletions blog/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ const CONFIG = {
// geoRouting: 'on',
productionDomain: 'business.adobe.com',
prodDomains: ['business.adobe.com'],
stageDomainsMap: {
'www.adobe.com': 'www.stage.adobe.com',
'business.adobe.com': 'business.stage.adobe.com',
'helpx.adobe.com': 'helpx.stage.adobe.com',
'blog.adobe.com': 'blog.stage.adobe.com',
'developer.adobe.com': 'developer-stage.adobe.com',
'news.adobe.com': 'news.stage.adobe.com',
},
contentRoot: '/blog',
codeRoot: '/blog',
taxonomyRoot: '/tags',
Expand Down
7 changes: 3 additions & 4 deletions blog/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const [setLibs, getLibs] = (() => {
(prodLibs, location) => {
libs = (() => {
const { hostname, search } = location || window.location;
if (!(hostname.includes('.hlx.') || hostname.includes('local'))) return prodLibs;
if (!['.hlx.', '.stage.', 'local'].some((i) => hostname.includes(i))) return prodLibs;
const branch = new URLSearchParams(search).get('milolibs') || 'main';
if (branch === 'local') return 'http://localhost:6456/libs';
return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`;
Expand Down Expand Up @@ -69,10 +69,9 @@ function getImageCaption(picture) {

// If the parent element doesn't have a caption, check if the next sibling does
const parentSiblingEl = parentEl.nextElementSibling;
if (!parentSiblingEl || !parentSiblingEl.querySelector('picture')) return undefined;
if (!parentSiblingEl || !parentSiblingEl.querySelector('picture')) return '';
const firstChildEl = parentSiblingEl.firstChild;
caption = firstChildEl?.tagName === 'EM' ? firstChildEl : undefined;
return caption;
if (firstChildEl?.tagName === 'EM') return firstChildEl;
}

async function buildArticleHeader(el) {
Expand Down
10 changes: 10 additions & 0 deletions tools/sidekick/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@
"passConfig": true,
"includePaths": [ "**.xlsx**" ]
},
{
"containerId": "tools",
"id": "floodgate",
"title": "Floodgate",
"environments": [ "edit" ],
"url": "https://main--bacom-blog--adobecom.hlx.page/tools/floodgate?milolibs=floodgateui",
"passReferrer": true,
"passConfig": true,
"includePaths": [ "**.xlsx**" ]
},
{
"containerId": "tools",
"title": "Tag Selector",
Expand Down

0 comments on commit 247d5c1

Please sign in to comment.