Skip to content

Commit e293afe

Browse files
authored
Merge pull request #508 from webstackdev/feature/fonts-and-social-updates
Revert deployment workflow, add swap fonts, change social network con…
2 parents 85cd1de + 5548aae commit e293afe

8 files changed

Lines changed: 206 additions & 231 deletions

File tree

.github/workflows/deployment.yml

Lines changed: 3 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,7 @@ jobs:
2424
uses: actions/github-script@v8
2525
with:
2626
script: |
27-
const workflowRun = context.payload.workflow_run;
28-
const headBranch = workflowRun?.head_branch;
29-
if (typeof headBranch === 'string' && headBranch.startsWith('hotfix/')) {
30-
core.info('hotfix/* branch detected; skipping CI job verification.');
31-
return;
32-
}
33-
34-
const runId = workflowRun.id;
27+
const runId = context.payload.workflow_run.id;
3528
const requiredJobs = ['Lint', 'Unit Tests'];
3629
const { data } = await github.rest.actions.listJobsForWorkflowRun({
3730
owner: context.repo.owner,
@@ -60,133 +53,24 @@ jobs:
6053
github.event.workflow_run.event == 'pull_request'
6154
6255
steps:
63-
- name: Hotfix branch — skip preview deploy
64-
if: ${{ startsWith(github.event.workflow_run.head_branch, 'hotfix/') }}
65-
run: |
66-
echo "hotfix/* branch detected; skipping preview deployment (treat as success)."
67-
6856
- name: Checkout repository
69-
if: ${{ !startsWith(github.event.workflow_run.head_branch, 'hotfix/') }}
7057
uses: actions/checkout@v6
7158
with:
7259
ref: ${{ github.event.workflow_run.head_sha }}
7360

74-
- name: Create GitHub deployment (Preview)
75-
if: ${{ !startsWith(github.event.workflow_run.head_branch, 'hotfix/') }}
76-
id: github-deployment-preview
77-
uses: actions/github-script@v8
78-
with:
79-
script: |
80-
const workflowRun = context.payload.workflow_run;
81-
const ref = workflowRun?.head_sha;
82-
if (!ref) {
83-
core.setFailed('Missing workflow_run.head_sha; cannot create GitHub deployment.');
84-
return;
85-
}
86-
87-
const { data } = await github.rest.repos.createDeployment({
88-
owner: context.repo.owner,
89-
repo: context.repo.repo,
90-
ref,
91-
auto_merge: false,
92-
required_contexts: [],
93-
environment: 'vercel-preview',
94-
transient_environment: true,
95-
production_environment: false,
96-
description: 'Vercel preview deployment'
97-
});
98-
99-
core.setOutput('deployment_id', String(data.id));
100-
10161
- name: Deploy to Vercel (Preview)
102-
if: ${{ !startsWith(github.event.workflow_run.head_branch, 'hotfix/') }}
10362
uses: amondnet/vercel-action@v41.1.4
10463
id: vercel-preview
10564
with:
10665
vercel-token: ${{ secrets.VERCEL_TOKEN }}
107-
github-token: ${{ secrets.GITHUB_TOKEN }}
10866
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
10967
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
11068
github-comment: false
11169
env:
11270
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
113-
GITHUB_SHA: ${{ github.event.workflow_run.head_sha }}
114-
GITHUB_REF: refs/heads/${{ github.event.workflow_run.head_branch }}
115-
116-
- name: Update GitHub deployment status (Preview)
117-
if: ${{ !startsWith(github.event.workflow_run.head_branch, 'hotfix/') && always() }}
118-
uses: actions/github-script@v8
119-
env:
120-
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
121-
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
122-
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
123-
with:
124-
script: |
125-
const deploymentIdRaw = '${{ steps.github-deployment-preview.outputs.deployment_id }}';
126-
const deploymentId = Number(deploymentIdRaw);
127-
if (!deploymentIdRaw || Number.isNaN(deploymentId)) {
128-
core.warning('Missing deployment id; skipping GitHub deployment status update.');
129-
return;
130-
}
131-
132-
const workflowRun = context.payload.workflow_run;
133-
const rawPreviewUrl = '${{ steps.vercel-preview.outputs.preview-url }}'.trim();
134-
const isVercelUrl = (url) => typeof url === 'string' && /vercel\.(app|com)/.test(url);
135-
const fallbackRunUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
136-
137-
const fetchDeploymentUrl = async () => {
138-
if (!process.env.VERCEL_TOKEN || !process.env.VERCEL_PROJECT_ID) {
139-
return null;
140-
}
141-
if (typeof fetch !== 'function') {
142-
return null;
143-
}
144-
const query = new URLSearchParams({
145-
projectId: process.env.VERCEL_PROJECT_ID,
146-
'meta-githubCommitSha': workflowRun?.head_sha ?? '',
147-
limit: '1'
148-
});
149-
if (process.env.VERCEL_ORG_ID) {
150-
query.set('teamId', process.env.VERCEL_ORG_ID);
151-
}
152-
const response = await fetch(`https://api.vercel.com/v6/deployments?${query.toString()}`, {
153-
headers: {
154-
Authorization: `Bearer ${process.env.VERCEL_TOKEN}`
155-
}
156-
});
157-
if (!response.ok) {
158-
return null;
159-
}
160-
const data = await response.json();
161-
const deployment = data?.deployments?.[0];
162-
if (deployment?.url) {
163-
return `https://${deployment.url}`;
164-
}
165-
if (deployment?.inspectorUrl) {
166-
return deployment.inspectorUrl.startsWith('http')
167-
? deployment.inspectorUrl
168-
: `https://${deployment.inspectorUrl}`;
169-
}
170-
return null;
171-
};
172-
173-
const previewUrl = isVercelUrl(rawPreviewUrl) ? rawPreviewUrl : await fetchDeploymentUrl();
174-
const state = '${{ steps.vercel-preview.outcome }}' === 'success' ? 'success' : 'failure';
175-
const targetUrl = isVercelUrl(previewUrl) ? previewUrl : fallbackRunUrl;
176-
177-
await github.rest.repos.createDeploymentStatus({
178-
owner: context.repo.owner,
179-
repo: context.repo.repo,
180-
deployment_id: deploymentId,
181-
state,
182-
environment: 'vercel-preview',
183-
environment_url: targetUrl,
184-
log_url: fallbackRunUrl,
185-
description: state === 'success' ? 'Vercel preview is ready' : 'Vercel preview failed'
186-
});
18771

18872
- name: Comment preview URL on PR
189-
if: ${{ !startsWith(github.event.workflow_run.head_branch, 'hotfix/') && always() && steps.vercel-preview.outcome == 'success' }}
73+
if: always() && steps.vercel-preview.outcome == 'success'
19074
uses: actions/github-script@v8
19175
env:
19276
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
@@ -301,7 +185,7 @@ jobs:
301185
}
302186
303187
- name: Comment preview failure on PR
304-
if: ${{ !startsWith(github.event.workflow_run.head_branch, 'hotfix/') && always() && steps.vercel-preview.outcome != 'success' }}
188+
if: always() && steps.vercel-preview.outcome != 'success'
305189
uses: actions/github-script@v8
306190
env:
307191
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
@@ -389,73 +273,16 @@ jobs:
389273
with:
390274
ref: ${{ github.event.workflow_run.head_sha }}
391275

392-
- name: Create GitHub deployment (Production)
393-
id: github-deployment-production
394-
uses: actions/github-script@v8
395-
with:
396-
script: |
397-
const workflowRun = context.payload.workflow_run;
398-
const ref = workflowRun?.head_sha;
399-
if (!ref) {
400-
core.setFailed('Missing workflow_run.head_sha; cannot create GitHub deployment.');
401-
return;
402-
}
403-
404-
const { data } = await github.rest.repos.createDeployment({
405-
owner: context.repo.owner,
406-
repo: context.repo.repo,
407-
ref,
408-
auto_merge: false,
409-
required_contexts: [],
410-
environment: 'production',
411-
transient_environment: false,
412-
production_environment: true,
413-
description: 'Vercel production deployment'
414-
});
415-
416-
core.setOutput('deployment_id', String(data.id));
417-
418276
- name: Deploy to Vercel (Production)
419277
uses: amondnet/vercel-action@v41.1.4
420278
id: vercel-production
421279
with:
422280
vercel-token: ${{ secrets.VERCEL_TOKEN }}
423-
github-token: ${{ secrets.GITHUB_TOKEN }}
424281
vercel-args: '--prod'
425282
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
426283
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
427284
env:
428285
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
429-
GITHUB_SHA: ${{ github.event.workflow_run.head_sha }}
430-
GITHUB_REF: refs/heads/${{ github.event.workflow_run.head_branch }}
431-
432-
- name: Update GitHub deployment status (Production)
433-
if: ${{ always() }}
434-
uses: actions/github-script@v8
435-
with:
436-
script: |
437-
const deploymentIdRaw = '${{ steps.github-deployment-production.outputs.deployment_id }}';
438-
const deploymentId = Number(deploymentIdRaw);
439-
if (!deploymentIdRaw || Number.isNaN(deploymentId)) {
440-
core.warning('Missing deployment id; skipping GitHub deployment status update.');
441-
return;
442-
}
443-
444-
const state = '${{ steps.vercel-production.outcome }}' === 'success' ? 'success' : 'failure';
445-
const rawUrl = '${{ steps.vercel-production.outputs.preview-url }}'.trim();
446-
const environmentUrl = rawUrl ? rawUrl : undefined;
447-
const logUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
448-
449-
await github.rest.repos.createDeploymentStatus({
450-
owner: context.repo.owner,
451-
repo: context.repo.repo,
452-
deployment_id: deploymentId,
453-
state,
454-
environment: 'production',
455-
environment_url: environmentUrl,
456-
log_url: logUrl,
457-
description: state === 'success' ? 'Production deploy completed' : 'Production deploy failed'
458-
});
459286

460287
- name: Log production deployment
461288
if: always() && steps.vercel-production.outcome == 'success'

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"Neue",
7070
"Niklas",
7171
"noabbr",
72+
"Noto",
7273
"octocat",
7374
"oden",
7475
"oembed",
@@ -90,6 +91,7 @@
9091
"repost",
9192
"reposts",
9293
"RGAA",
94+
"Roboto",
9395
"rodgtr",
9496
"Ryuk",
9597
"samp",

_TODO.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -202,26 +202,6 @@ Adds some custom directives:
202202
1. Add `rel="prefetch"` to any `<a />` tags to prefetch when visible
203203
2. Add `rel="prefetch-intent"` to any `<a />` links on your page to prefetch them only when they are hovered over, touched, or focused.
204204

205-
### [astro-webfinger](https://www.npmjs.com/package/astro-webfinger)
206-
207-
Allows any Mastodon instance to discover your Mastodon profile directly from your own domain.
208-
209-
210-
## Refactor social networks in Authors collection to Contact collection format
211-
212-
The contact data collection uses an array of social networks, with keys:
213-
214-
```
215-
{
216-
network: z.string(),
217-
name: z.string(),
218-
url: z.string().url(),
219-
order: z.number(),
220-
}
221-
```
222-
223-
The authors collection is using named entries under a "social" property, like "twitter", "github", etc. This task is to refactor that to use an array like contact data collection. We also need to add a color for the social network icon, or some other approach to setting the color of it while enabling theming.
224-
225205
## Stuff from ZMarkdown, a prepackaged Unified config
226206

227207
Repo is in root of Corporate Websites

src/components/scripts/utils/environmentClient.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
* This file cannot be used in API endpoint code. See
33
* src/lib/config/environmentServer.ts for details.
44
*/
5-
import { PACKAGE_RELEASE_VERSION, PRIVACY_POLICY_VERSION, PUBLIC_GOOGLE_MAPS_API_KEY } from 'astro:env/client'
5+
import {
6+
PACKAGE_RELEASE_VERSION,
7+
PRIVACY_POLICY_VERSION,
8+
PUBLIC_GOOGLE_MAPS_API_KEY
9+
} from 'astro:env/client'
610
import { ClientScriptError } from '@components/scripts/errors'
711

812
/**

src/content.config.ts

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ const createBaseCollectionSchema = ({ image }: SchemaContext) =>
5858
tags: z.array(z.enum(validTags)),
5959
})
6060

61+
const createSocialCollectionSchema = () =>
62+
z.array(
63+
z.object({
64+
network: z.string(),
65+
name: z.string(),
66+
url: z.string().url(),
67+
order: z.number(),
68+
}),
69+
)
70+
6171
/**
6272
* =================================================================================
6373
*
@@ -170,20 +180,7 @@ const authorsCollection = defineCollection({
170180
name: z.string(),
171181
email: z.string().email(),
172182
avatar: z.string(),
173-
social: z.object({
174-
twitter: z.object({
175-
name: z.string(),
176-
url: z.string().url(),
177-
}),
178-
github: z.object({
179-
name: z.string(),
180-
url: z.string().url(),
181-
}),
182-
linkedin: z.object({
183-
name: z.string(),
184-
url: z.string().url(),
185-
}),
186-
}),
183+
social: createSocialCollectionSchema(),
187184
}),
188185
})
189186

@@ -202,14 +199,7 @@ const contactDataCollection = defineCollection({
202199
telephoneLocal: z.string(),
203200
telephoneMobile: z.string(),
204201
telephoneTollFree: z.string(),
205-
social: z.array(
206-
z.object({
207-
network: z.string(),
208-
name: z.string(),
209-
url: z.string().url(),
210-
order: z.number(),
211-
}),
212-
),
202+
social: createSocialCollectionSchema(),
213203
}),
214204
})
215205

src/content/authors/kevin-brown.mdx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,28 @@ name: "Kevin Brown"
44
email: "kevin@webstackbuilders.com"
55
avatar: "/images/avatars/kevin-brown.webp"
66
social:
7-
twitter:
7+
- network: "x"
88
name: "WebstackDev"
99
url: "https://x.com/WebstackDev"
10-
github:
10+
order: 1
11+
- network: "github"
1112
name: "webstackdev"
1213
url: "https://github.com/webstackdev"
13-
linkedin:
14+
order: 2
15+
- network: "linkedin"
1416
name: "kevin-brown-developer"
1517
url: "https://www.linkedin.com/in/kevin-brown-developer/"
18+
order: 3
19+
- network: "codepen"
20+
name: "WebstackDev"
21+
url: "https://codepen.io/webstackdev"
22+
order: 4
23+
- network: "bluesky"
24+
name: "webstackdev.bsky.social"
25+
url: "https://bsky.app/profile/webstackdev.bsky.social"
26+
order: 5
27+
- network: "mastodon"
28+
name: "@webstackdev"
29+
url: "https://k8s.social/@webstackdev"
30+
order: 6
1631
---

0 commit comments

Comments
 (0)