Skip to content

Commit

Permalink
Add Jenkins files
Browse files Browse the repository at this point in the history
Fix date issues as well.

Signed-off-by: Lance Albertson <[email protected]>
  • Loading branch information
ramereth committed Oct 4, 2024
1 parent 4d2b659 commit c39757c
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 10 deletions.
62 changes: 62 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
pipeline {
agent 'web2'
environment {
GITHUB_TOKEN = credentials('site_pr_builder')
STAGING_PATH = "/var/www/staging.osuosl.org/htdocs"
PRODUCTION_PATH = "/var/www/new.osuosl.org/htdocs"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build Hugo Site') {
steps {
script {
sh 'hugo --minify' // Build the Hugo site for all branches
}
}
}
stage('Deploy Site') {
steps {
script {
if (env.BRANCH_NAME == 'main') {
// Deploy to production when the branch is 'main'
sh """
rsync -avz --delete public/ ${PRODUCTION_PATH}/
"""
} else if (env.CHANGE_ID) {
// Deploy to a staging directory based on the PR number
def stagingPath = "${STAGING_PATH}/osuosl-website-${env.CHANGE_ID}"
sh """
rsync -avz --delete public/ ${stagingPath}/
"""
} else {
echo "Not a PR or main branch, skipping deployment"
}
}
}
}
}
post {
always {
script {
def buildStatus = currentBuild.result ?: 'SUCCESS'
def siteUrl = ""
if (env.BRANCH_NAME == 'main') {
siteUrl = "https://new.osuosl.org/"
} else if (env.CHANGE_ID) {
siteUrl = "https://osuosl-website-${env.CHANGE_ID}.staging.osuosl.org/"
}

// Post build status with a link to the site
githubNotify context: 'Jenkins CI',
description: 'Build completed',
status: buildStatus.toLowerCase(),
targetUrl: "${env.BUILD_URL}",
message: "Site available: ${siteUrl}"
}
}
}
}
4 changes: 2 additions & 2 deletions content/blog/bbc17.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Beaver BarCamp 17: New Horizons"
date: 2017-05-9
date: 2017-05-09
authors: ["Amanda Kelner"]
slug: bbc17
---
Expand Down Expand Up @@ -69,4 +69,4 @@ broader range of sessions. If you have suggestions or would like to let us know
what you thought of BarCamp or if you weren’t able to make it this year and
would like to let us know how to make it easier for you to attend, fill out our
[feedback survey](https://docs.google.com/forms/d/e/1FAIpQLSfY9BvXSNlniy0DJle3Dr3xQ54gpCaGSW_Xk-mjWxXTGusqng/viewform?usp=sf_link)
so the improvements we make next year will help everyone get the most out of BarCamp.
so the improvements we make next year will help everyone get the most out of BarCamp.
4 changes: 2 additions & 2 deletions content/blog/connecting-at-beaver-barcamp-12.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Connecting at Beaver BarCamp 12
date: 2013-10-17 17:56
date: 2013-10-17
authors: ["Melissa"]
slug: connecting-at-beaver-barcamp-12
---
Expand Down Expand Up @@ -67,4 +67,4 @@ BarCamp for the first time and participated in PowerPoint karaoke.
![Beaver Bar Camp](/images/bbc12-blog-post.jpg#blog-center)

*“I'd heard about PowerPoint karaoke but didn't quite know what to expect,” says
Earl. “It was a fun time and a good chance to practice speaking skills.”*
Earl. “It was a fun time and a good chance to practice speaking skills.”*
2 changes: 1 addition & 1 deletion content/blog/open-source-bridge-promotes-community.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Open Source Bridge Promotes Community
date: 2013-06-24 21:54
date: 2013-06-24
authors: ["Melissa Morse"]
slug: open-source-bridge-promotes-community
---
Expand Down
2 changes: 1 addition & 1 deletion content/blog/openstack-on-openpower.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: OpenStack on OpenPOWER
date: 2014-04-23 12:45
date: 2014-04-23
authors: ["ramereth"]
slug: openstack-on-openpower
---
Expand Down
2 changes: 1 addition & 1 deletion content/blog/openstacks-horizon.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Openstack's Horizon
date: 2014-02-20 22:32
date: 2014-02-20
authors: ["Melissa"]
slug: openstacks-horizon
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "OSL Announces 10 year Celebration; Attends OSCON"
date: 2013-07-30 21:03
date: 2013-07-30
authors: ["Melissa"]
slug: osl-announces-10-year-celebration-attends-oscon
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: OSL Staff Mentors International Students Through Google Summer of Code
date: 2013-02-11 23:57
date: 2013-02-11
authors: ["Kayla Harr"]
slug: osl-staff-mentors-international-students-through-google-summer-of-code
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: OSL to Mentor Four in Google Summer of Code
date: 2013-06-05 20:11
date: 2013-06-05
authors: ["Kayla Harr"]
slug: osl-to-mentor-four-in-google-summer-of-code
---
Expand Down

0 comments on commit c39757c

Please sign in to comment.