-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix date issues as well. Signed-off-by: Lance Albertson <[email protected]>
- Loading branch information
Showing
9 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
content/blog/osl-announces-10-year-celebration-attends-oscon.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../blog/osl-staff-mentors-international-students-through-google-summer-of-code.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters