mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-11 11:43:58 +02:00
Add script to update sponsors
This commit is contained in:
2
.github/workflows/update-sponsors.yml
vendored
2
.github/workflows/update-sponsors.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Update the Sponsors
|
- name: Update the Sponsors
|
||||||
run: |
|
run: |
|
||||||
pnpm install
|
pnpm install
|
||||||
node bin/roadmap-ads.cjs
|
node bin/update-sponsors.cjs
|
||||||
- name: Create PR
|
- name: Create PR
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
|
@@ -51,25 +51,34 @@ function populateRoadmapAds({
|
|||||||
const existingFrontmatter = roadmapFileContent.match(frontMatterRegex)[1];
|
const existingFrontmatter = roadmapFileContent.match(frontMatterRegex)[1];
|
||||||
const contentWithoutFrontmatter = roadmapFileContent.replace(frontMatterRegex, ``).trim();
|
const contentWithoutFrontmatter = roadmapFileContent.replace(frontMatterRegex, ``).trim();
|
||||||
|
|
||||||
const yamlObject = yaml.load(existingFrontmatter);
|
let fronmatterObj = yaml.load(existingFrontmatter);
|
||||||
|
|
||||||
if (shouldShowAd) {
|
if (shouldShowAd) {
|
||||||
yamlObject.sponsor = {
|
const frontmatterValues = Object.entries(fronmatterObj);
|
||||||
url: redirectUrl,
|
|
||||||
title: adTitle,
|
// Insert sponsor data at 10 index i.e. after
|
||||||
imageUrl,
|
// roadmap dimensions in the fronmatter
|
||||||
description: adDescription,
|
frontmatterValues.splice(10, 0, [
|
||||||
event: {
|
'sponsor',
|
||||||
category: 'SponsorClick',
|
{
|
||||||
action: `${company} Redirect`,
|
url: redirectUrl,
|
||||||
label: `Clicked ${company} Link`,
|
title: adTitle,
|
||||||
|
imageUrl,
|
||||||
|
description: adDescription,
|
||||||
|
event: {
|
||||||
|
category: 'SponsorClick',
|
||||||
|
action: `${company} Redirect`,
|
||||||
|
label: `Clicked ${company} Link`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
]);
|
||||||
|
|
||||||
|
fronmatterObj = Object.fromEntries(frontmatterValues);
|
||||||
} else {
|
} else {
|
||||||
delete yamlObject.sponsor;
|
delete fronmatterObj.sponsor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newFrontmatter = yaml.dump(yamlObject, { lineWidth: 10000, forceQuotes: true, quotingType: '"' });
|
const newFrontmatter = yaml.dump(fronmatterObj, { lineWidth: 10000, forceQuotes: true, quotingType: '"' });
|
||||||
const newContent = `---\n${newFrontmatter}---\n\n${contentWithoutFrontmatter}`;
|
const newContent = `---\n${newFrontmatter}---\n\n${contentWithoutFrontmatter}`;
|
||||||
|
|
||||||
fs.writeFileSync(roadmapFilePath, newContent, 'utf8');
|
fs.writeFileSync(roadmapFilePath, newContent, 'utf8');
|
@@ -11,12 +11,6 @@ tnsBannerLink: "https://thenewstack.io?utm_source=roadmap.sh&utm_medium=Referral
|
|||||||
dimensions:
|
dimensions:
|
||||||
width: 968
|
width: 968
|
||||||
height: 2527.46
|
height: 2527.46
|
||||||
schema:
|
|
||||||
headline: "DevOps Roadmap"
|
|
||||||
description: "Learn to become a DevOps, SRE or get any other operations role with this interactive step by step guide in 2023. We also have resources and short descriptions attached to the roadmap items so you can get everything you want to learn in one place."
|
|
||||||
imageUrl: "https://roadmap.sh/roadmaps/devops.png"
|
|
||||||
datePublished: "2023-01-05"
|
|
||||||
dateModified: "2023-01-20"
|
|
||||||
sponsor:
|
sponsor:
|
||||||
url: "https://www.getambassador.io/products/edge-stack-api-gateway?utm_source=roadmap-sh&utm_medium=edge-stack-page&utm_campaign=new-account"
|
url: "https://www.getambassador.io/products/edge-stack-api-gateway?utm_source=roadmap-sh&utm_medium=edge-stack-page&utm_campaign=new-account"
|
||||||
title: "Featured Product"
|
title: "Featured Product"
|
||||||
@@ -26,6 +20,12 @@ sponsor:
|
|||||||
category: "SponsorClick"
|
category: "SponsorClick"
|
||||||
action: "Ambassador Redirect"
|
action: "Ambassador Redirect"
|
||||||
label: "Clicked Ambassador Link"
|
label: "Clicked Ambassador Link"
|
||||||
|
schema:
|
||||||
|
headline: "DevOps Roadmap"
|
||||||
|
description: "Learn to become a DevOps, SRE or get any other operations role with this interactive step by step guide in 2023. We also have resources and short descriptions attached to the roadmap items so you can get everything you want to learn in one place."
|
||||||
|
imageUrl: "https://roadmap.sh/roadmaps/devops.png"
|
||||||
|
datePublished: "2023-01-05"
|
||||||
|
dateModified: "2023-01-20"
|
||||||
seo:
|
seo:
|
||||||
title: "DevOps Roadmap: Learn to become a DevOps Engineer or SRE"
|
title: "DevOps Roadmap: Learn to become a DevOps Engineer or SRE"
|
||||||
description: "Community driven, articles, resources, guides, interview questions, quizzes for DevOps. Learn to become a modern DevOps engineer by following the steps, skills, resources and guides listed in this roadmap."
|
description: "Community driven, articles, resources, guides, interview questions, quizzes for DevOps. Learn to become a modern DevOps engineer by following the steps, skills, resources and guides listed in this roadmap."
|
||||||
|
Reference in New Issue
Block a user