Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 9 additions & 58 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,75 +13,26 @@ jobs:
clean: 'true'
- script: |
touch Gemfile.lock ; chmod 777 Gemfile.lock
- task: Docker@0
displayName: 'Jekyll and all Ruby steps'
inputs:
containerRegistryType: 'Container Registry'
action: 'Run an image'
# should match Gemfile:
imageName: 'jekyll/builder:latest'
volumes: |
$(build.sourcesDirectory):/srv/jekyll
$(build.binariesDirectory):/srv/jekyll/_site
#containerCommand: 'sh -x -c "apk add --no-cache fontconfig ttf-freefont && bundle install && bash -e get-deps.sh && JEKYLL_ENV=production jekyll build && bundle exec htmlproofer --only-4xx --empty-alt-ignore --check-html --checks-to-ignore ImageCheck --file-ignore \"/apidocs/,/generated/\" --log-level debug _site"'
#containerCommand: 'sh -x -c "apk add --no-cache fontconfig ttf-freefont && bundle install && bash -e get-deps.sh && JEKYLL_ENV=production jekyll build"'
containerCommand: 'sh -x -c "apk add --no-cache fontconfig ttf-freefont && bundle install && JEKYLL_ENV=production jekyll build"'
detached: false
- bash: |
set -e
# not sure why some files are root owned, maybe docker
sudo chown -R $(id -u):$(id -g) $BUILD_SOURCESDIRECTORY $BUILD_BINARIESDIRECTORY
COMMIT=$(git rev-parse HEAD)
# Determine whether to publish staging or live site
if [ -n "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" ] ; then
gh_url="https://${GITHUB_AUTH}@github.com/Terracotta-OSS/terracotta.org-site.git"
gh_branch=gh-pages
gh_source="#${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}"
echo "Publishing staging from $gh_source"
elif [ "$BUILD_SOURCEBRANCHNAME" == 'master' ] ; then
gh_url="https://${GITHUB_AUTH}@github.com/Terracotta-OSS/terracotta-oss.github.io.git"
gh_branch=master
gh_source=master
echo "Publishing Live site"
#(bash add-analytics.sh $BUILD_SOURCESDIRECTORY $BUILD_BINARIESDIRECTORY)
else
echo "Unknown branch to deploy: $BUILD_SOURCEBRANCHNAME"
exit 5
fi
rm -rf * .git* # start clean in source directory
git clone --single-branch -b $gh_branch $gh_url remote-site
cd remote-site
echo "Target dir:"; ls -l
echo "Generated dir:"; ls -l $BUILD_BINARIESDIRECTORY
rsync -a --delete --exclude .git --exclude CNAME $BUILD_BINARIESDIRECTORY/ .
echo "Result:"; ls -l
git config --local user.name "autogen"
git config --local user.email "[email protected]"
git add -A .
git status
git commit -m "Autogenerated from ${gh_source} ${COMMIT}"
git push $gh_url $gh_branch
env:
GITHUB_AUTH: $(gh_user):$(gh_token)
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
displayName: 'Publish'
- bash: |
set -e
uname -a
cat /etc/*elease*
npm -v
node -v
npm install netlify-cli
env
#npm install netlify-cli
du -sh $BUILD_BINARIESDIRECTORY
find $BUILD_BINARIESDIRECTORY | wc -l
echo "Site ID $NETLIFY_SITE_ID"
$(npm bin)/netlify deploy -d $BUILD_BINARIESDIRECTORY --json | tee netlify.json
NETLIFY_URL=$(jq -r '.deploy_url' netlify.json)
echo "Informing GitHub about deploy url: ${NETLIFY_URL}"
curl -H "Authorization: token ${GTOKEN}" -X POST -d "{\"body\": \"[A Live Preview](${NETLIFY_URL}) of this Pull Request at commit ${SYSTEM_PULLREQUEST_SOURCECOMMITID} is now available\", \"commit_id\": \"${SYSTEM_PULLREQUEST_SOURCECOMMITID}\"}" "https://api.github.com/repos/Terracotta-OSS/terracotta.org-site/pulls/${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}/comments"
#$(npm bin)/netlify deploy -d $BUILD_BINARIESDIRECTORY --json | tee netlify.json
#NETLIFY_URL=$(jq -r '.deploy_url' netlify.json)
echo "Informing GitHub about deploy url: ${NETLIFY_URL} via https://api.github.com/repos/Terracotta-OSS/terracotta.org-site/pulls/${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}/comments"
#curl -H "Authorization: token ${GTOKEN}" -X POST -d "{\"body\": \"[A Live Preview](${NETLIFY_URL}) of this Pull Request at commit ${SYSTEM_PULLREQUEST_SOURCECOMMITID} is now available\", \"commit_id\": \"${SYSTEM_PULLREQUEST_SOURCECOMMITID}\"}" "https://api.github.com/repos/Terracotta-OSS/terracotta.org-site/pulls/${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}/comments"
set -x
curl -u $GH_USER:$GTOKEN -X POST -d "{\"body\": \"[A Live Preview](${NETLIFY_URL}) of this Pull Request at commit ${SYSTEM_PULLREQUEST_SOURCECOMMITID} is now available\", \"commit_id\": \"${SYSTEM_PULLREQUEST_SOURCECOMMITID}\"}" "https://api.github.com/repos/Terracotta-OSS/terracotta.org-site/issues/${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}/comments"
displayName: 'Netlify Publish'
env:
NETLIFY_SITE_ID: $(netlify_site_id)
NETLIFY_AUTH_TOKEN: $(netlify_auth_token)
GTOKEN: $(gh.token)
GTOKEN: $(gh_temp_token)
condition: eq(variables['Build.Reason'], 'PullRequest')