Skip to content

Commit d27b11f

Browse files
committed
Merge remote-tracking branch 'origin/doc-updates' into feature/add-svgs
2 parents eb0e34f + 0cc1b15 commit d27b11f

31 files changed

Lines changed: 7467 additions & 130 deletions

.github/workflows/build-and-push.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Build React Application
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
newVersion:
7+
description: 'new version?'
8+
required: true
9+
type: string
10+
version:
11+
description: 'The version of the file to build and push'
12+
required: true
13+
type: string
14+
tag:
15+
description: 'The tag of the image to build and push'
16+
required: true
17+
type: string
18+
channel:
19+
description: 'The channel of the image to build and push'
20+
required: true
21+
type: string
22+
jobs:
23+
Build:
24+
runs-on: ubuntu-latest
25+
permissions:
26+
id-token: write
27+
contents: write
28+
steps:
29+
- name: Checkout Repo
30+
uses: actions/checkout@v4
31+
- name: Use Node 20
32+
uses: actions/setup-node@v4
33+
with:
34+
cache: npm
35+
node-version: '20'
36+
registry-url: 'https://npm.pkg.github.com'
37+
- name: Set package.json version
38+
run: |
39+
if [ '${{ inputs.newVersion }}' = 'true' ]; then
40+
echo "Setting package.json version to ${{ inputs.version }}"
41+
npm version ${{ inputs.version }} --no-git-tag-version
42+
else
43+
echo "Not setting package.json version"
44+
fi
45+
- name: Install Packages
46+
run: |
47+
npm ci
48+
- name: Build App
49+
id: build
50+
run: |
51+
# Enable pipefail to ensure the step fails if npm build fails
52+
set -o pipefail
53+
54+
echo "## Build Output" >> $GITHUB_STEP_SUMMARY
55+
echo "" >> $GITHUB_STEP_SUMMARY
56+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
57+
58+
# Run build and capture output, but handle failure gracefully for summary
59+
if npm run build 2>&1 | tee build_output.log; then
60+
echo "Build completed successfully"
61+
else
62+
echo "Build failed - capturing output for summary"
63+
fi
64+
65+
# Always add the build output to summary (success or failure)
66+
sed 's/\x1b\[[0-9;]*m//g' build_output.log >> $GITHUB_STEP_SUMMARY
67+
echo "" >> $GITHUB_STEP_SUMMARY
68+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
69+
70+
# Check if build actually failed and exit with error code
71+
if [ ! -d "dist" ]; then
72+
echo "Build failed - dist directory not created"
73+
exit 1
74+
fi
75+
- name: Clean up after failed build
76+
if: failure() && steps.build.conclusion == 'failure'
77+
run: |
78+
git push origin --delete ${{ inputs.tag }}
79+
80+
echo "" >> $GITHUB_STEP_SUMMARY
81+
echo "---" >> $GITHUB_STEP_SUMMARY
82+
echo "## Build Result" >> $GITHUB_STEP_SUMMARY
83+
echo "" >> $GITHUB_STEP_SUMMARY
84+
echo "❌ **BUILD FAILED**" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
echo "The build output above shows the specific errors that caused the build to fail." >> $GITHUB_STEP_SUMMARY
87+
- name: Archive Output
88+
if: success()
89+
id: package
90+
run: |
91+
cd dist
92+
branch=${GITHUB_REF#refs/heads/}
93+
repo_name=${GITHUB_REPOSITORY#*/}
94+
95+
if [ '${{ inputs.newVersion }}' = 'true' ]; then
96+
filename=${repo_name}-${{ inputs.tag }}.zip
97+
else
98+
filename=${repo_name}-${branch//\//-}.zip
99+
fi
100+
101+
zip -r ../$filename .
102+
echo "filename=${filename}" >> $GITHUB_OUTPUT
103+
- name: Get release notes
104+
if: success() && inputs.newVersion == 'true'
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: change-log
108+
- name: Create Release
109+
id: create_release
110+
if: success() && inputs.newVersion == 'true'
111+
uses: ncipollo/release-action@v1
112+
with:
113+
artifacts: './${{ steps.package.outputs.filename }}'
114+
bodyFile: ./CHANGELOG.md
115+
prerelease: ${{ inputs.channel != '' }}
116+
tag: ${{ inputs.tag }}
117+
commit: ${{ github.sha }}
118+
allowUpdates: true

.github/workflows/ci.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
name: Build CH5
2-
1+
name: Build Application
32
on:
43
push:
54
branches:
65
- '**'
76
jobs:
8-
get_version:
9-
uses: ./.github/workflows/get-version.yaml
7+
getVersion:
8+
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-getversion.yml@main
109
secrets: inherit
11-
build_and_push:
12-
uses: ./.github/workflows/build-and-push.yaml
10+
build:
11+
uses: PepperDash/workflow-templates/.github/workflows/react-app-build.yml@main
1312
secrets: inherit
14-
needs: get_version
13+
needs: getVersion
1514
with:
16-
newVersion: ${{ needs.get_version.outputs.newVersion }}
17-
version: ${{ needs.get_version.outputs.version }}
18-
hash: ${{ needs.get_version.outputs.hash }}
19-
tag: ${{ needs.get_version.outputs.tag }}
20-
channel: ${{ needs.get_version.outputs.channel }}
15+
newVersion: ${{ needs.getVersion.outputs.newVersion }}
16+
version: ${{ needs.getVersion.outputs.version }}
17+
tag: ${{ needs.getVersion.outputs.tag }}
18+
channel: ${{ needs.getVersion.outputs.channel }}

.github/workflows/get-version.yaml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
value: ${{ jobs.get_version.outputs.tag }}
1212
newVersion:
1313
description: 'Was a new version generated?'
14-
value: ${{ jobs.get_version.outputs.newVersion }}
14+
value: ${{ jobs.get_version.outputs.newVersion }}
1515
type:
1616
description: 'The type of version bump'
1717
value: ${{ jobs.get_version.outputs.type }}
@@ -31,13 +31,35 @@ jobs:
3131
channel: ${{ steps.get_version.outputs.channel }}
3232
newVersion: ${{ steps.get_version.outputs.newVersion }}
3333
steps:
34-
- uses: actions/checkout@v3
35-
- uses: actions/setup-node@v3 # v3
34+
- uses: actions/checkout@v4
35+
- uses: actions/setup-node@v4 # v4
3636
with:
3737
cache: npm
3838
node-version: lts/*
3939
registry-url: https://npm.pkg.github.com
40-
scope: '@pepperdash-products'
40+
scope: "@pepperdash"
41+
- name: Get branch name
42+
id: get_branch
43+
run: |
44+
branch=${GITHUB_REF#refs/heads/}
45+
echo "branch=$branch" >> $GITHUB_OUTPUT
46+
echo "prerelease=${branch//\//-}" >> $GITHUB_OUTPUT
47+
env:
48+
GITHUB_REF: ${{ github.ref }}
49+
- name: Replace branch name in .releaserc.json
50+
if: steps.get_branch.outputs.branch != 'main'
51+
uses: jacobtomlinson/gha-find-replace@v3
52+
with:
53+
find: 'replace-me-feature-branch'
54+
replace: '${{ steps.get_branch.outputs.branch }}'
55+
include: '.releaserc.json'
56+
- name: Replace prerelease name in .releaserc.json
57+
if: steps.get_branch.outputs.branch != 'main'
58+
uses: jacobtomlinson/gha-find-replace@v3
59+
with:
60+
find: 'replace-me-prerelease'
61+
replace: '${{ steps.get_branch.outputs.prerelease }}'
62+
include: '.releaserc.json'
4163
- name: Get version number
4264
id: get_version
4365
run: |
@@ -50,12 +72,11 @@ jobs:
5072
-- semantic-release
5173
echo "hash=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
5274
env:
53-
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
75+
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
5476
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5677
- name: Print summary if no new version
5778
if: steps.get_version.outputs.newVersion != 'true'
58-
run: |
79+
run: |
5980
branch=${GITHUB_REF#refs/heads/}
6081
echo "# UI V2 Summary" >> $GITHUB_STEP_SUMMARY
6182
echo "No new version generated" >> $GITHUB_STEP_SUMMARY
@@ -72,7 +93,7 @@ jobs:
7293
if: steps.get_version.outputs.newVersion == 'true'
7394
run: |
7495
echo "# UI V2 Summary" >> $GITHUB_STEP_SUMMARY
75-
96+
7697
echo "Version: ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
7798
echo "Tag: ${{ steps.get_version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
7899
echo "New Version: ${{ steps.get_version.outputs.newVersion }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)