Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
name: Deployment
on:
push:
branches:
- main
workflow_dispatch:
inputs:
env:
description: "Select environment to deploy to"
type: choice
required: true
default: "stage"
default: "prod"
options:
- stage
- prod
- stage & prod
- "prod"
- "stage & prod"
baseSha:
description: "Use base SHA commit to deploy from (empty string defaults to last commit before HEAD)"
type: string
Expand All @@ -26,14 +28,6 @@ jobs:
name: Deployment
uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy.yml@main
with:
env: ${{ inputs.env }}
baseSha: ${{ inputs.baseSha }}
deployAll: ${{ inputs.deployAll }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint
run: npx --yes github:AdobeDocs/adp-devsite-utils runLint -v
env: ${{ inputs.env || 'prod' }}
baseSha: ${{ inputs.baseSha || '' }}
deployAll: ${{ inputs.deployAll || false }}
32 changes: 16 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Lint
on:
pull_request:
branches: [main]
paths:
- 'src/pages/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint
run: npx --yes github:AdobeDocs/adp-devsite-utils runLint -v
name: Lint
on:
pull_request:
branches: [main]
paths:
- 'src/pages/**'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint
run: npx --yes github:AdobeDocs/adp-devsite-utils runLint -v
22 changes: 22 additions & 0 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Staging
on:
workflow_dispatch:
inputs:
baseSha:
description: "Use base SHA commit to deploy from (empty string defaults to last commit before HEAD)"
type: string
required: false
default: ""
deployAll:
description: "Force deploy all files"
type: boolean
default: false
jobs:
deployment:
name: Deployment
uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy.yml@main
with:
env: stage
baseSha: ${{ inputs.baseSha }}
deployAll: ${{ inputs.deployAll }}
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# npm yarn
node_modules
package.lock
package-lock.json
yarn-error.log
.pnp.*
.yarn/*
Expand Down Expand Up @@ -43,4 +43,7 @@ local-test.yml

# yalc
.yalc
yalc.lock
yalc.lock

# json files
adp-site-metadata.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Documentation

Please see the [centralized README](https://github.com/AdobeDocs/adp-devsite-utils/blob/main/README.md).
Please see the [ADP Developer Site Documentation](https://developer-stage.adobe.com/dev-docs-reference/).
15 changes: 13 additions & 2 deletions dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ import express from 'express';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { execSync } from 'child_process';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const PORT = process.env.DEV_PORT || 3003;

// TODO: ensure `DOCS_DIRECTORY` starts with `/`
const getCurrentBranch = () => {
try {
return execSync('git branch --show-current', { encoding: 'utf8' }).trim();
} catch (error) {
console.warn('Could not determine git branch, defaulting to "main"');
return 'main';
}
};

const currentBranch = getCurrentBranch();
const DOCS_DIRECTORY = process.env.DIRECTORY || './src/pages';

const app = express();
Expand All @@ -19,10 +29,11 @@ app.use(
express.static(path.resolve(__dirname, `./${DOCS_DIRECTORY}`), {
setHeaders: (res) => {
res.setHeader('last-modified', new Date().toGMTString());
res.setHeader('local-branch-name', currentBranch);
},
}),
);

app.listen(PORT, () => {
console.debug(`Docs dev server is running on port ${PORT}`);
});
});
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"redirectCheck:stage": "npx --yes github:AdobeDocs/adp-devsite-utils redirectChecker stage --verbose",
"redirectCheck:prod": "npx --yes github:AdobeDocs/adp-devsite-utils redirectChecker prod --verbose"
},
"packageManager": "yarn@3.2.1",
"devDependencies": {
"express": "5.1.0"
}
Expand Down