[ci] Merge release.sh into build-{deploy,doc}.sh with manual github releases
A draft github release is created or the latest release is reused, if it is a draft release. Assets are uploaded, release notes are added. The release is left in draft state.
This commit is contained in:
18
.travis.yml
18
.travis.yml
@ -13,8 +13,6 @@ env:
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- os: windows
|
||||
include:
|
||||
- name: "linux - mvn deploy"
|
||||
os: linux
|
||||
@ -49,22 +47,6 @@ script: source .travis/build-$BUILD.sh
|
||||
after_success: true
|
||||
|
||||
|
||||
before_deploy: true
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: ${GITHUB_OAUTH_TOKEN}
|
||||
file_glob: true
|
||||
file:
|
||||
- pmd-dist/target/pmd-*.zip
|
||||
- docs/pmd-doc-*.zip
|
||||
skip_cleanup: true
|
||||
draft: true
|
||||
on:
|
||||
tags: true
|
||||
repo: pmd/pmd
|
||||
condition: "${TRAVIS_SECURE_ENV_VARS} = true && ${BUILD} != sonar && ${BUILD} != coveralls && ${TRAVIS_OS_NAME} = linux"
|
||||
after_deploy: bash .travis/release.sh
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
|
@ -59,6 +59,63 @@ elif travis_isPush; then
|
||||
log_info "This is a release build for tag ${TRAVIS_TAG}"
|
||||
echo -e "\n\n"
|
||||
./mvnw deploy -Possrh,sign,pmd-release $MVN_BUILD_FLAGS
|
||||
echo -e "\n\n"
|
||||
|
||||
# Deploy to ossrh has already been done with the usual maven build
|
||||
|
||||
# Deploy to github releases
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" 'https://api.github.com/repos/pmd/pmd/releases?per_page=1'|jq ".[0].id")
|
||||
RELEASE_DATA=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" "https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}")
|
||||
DRAFT=$(echo "$RELEASE_DATA"|jq ".draft")
|
||||
if [ "$DRAFT" != "true" ]; then
|
||||
REQUEST=$(cat <<EOF
|
||||
{
|
||||
"tag_name": "${TRAVIS_TAG}",
|
||||
"target_commitish": "$(git show-ref --hash HEAD)",
|
||||
"name": "${TRAVIS_TAG}",
|
||||
"draft": true
|
||||
}
|
||||
EOF
|
||||
)
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" \
|
||||
--data "${REQUEST}" -X POST https://api.github.com/repos/pmd/pmd/releases | jq ".id")
|
||||
echo $RELEASE_ID
|
||||
log_info "Created draft release with id ${RELEASE_ID}"
|
||||
else
|
||||
log_info "Using draft release with id "${RELEASE_ID}"
|
||||
fi
|
||||
UPLOAD_URL=$(echo "$RELEASE_DATA" | jq --raw-output ".upload_url")
|
||||
UPLOAD_URL=${UPLOAD_URL%%\{\?name,label\}}
|
||||
echo "Uploading pmd-bin-${VERSION}.zip ..."
|
||||
curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/zip" \
|
||||
--data-binary "@pmd-dist/target/pmd-bin-${VERSION}.zip" \
|
||||
-X POST "${UPLOAD_URL}?name=pmd-bin-${VERSION}.zip"
|
||||
echo "Uploading pmd-src-${VERSION}.zip ..."
|
||||
curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/zip" \
|
||||
--data-binary "@pmd-dist/target/pmd-src-${VERSION}.zip" \
|
||||
-X POST "${UPLOAD_URL}?name=pmd-src-${VERSION}.zip"
|
||||
|
||||
|
||||
# Deploy to sourceforge files
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
echo -e "\n\n"
|
||||
log_info "Uploading pmd distribution to sourceforge..."
|
||||
.travis/travis_wait "rsync -avh pmd-dist/target/pmd-*-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/"
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Error while uploading pmd-*-${VERSION}.zip to sourceforge!"
|
||||
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd/"
|
||||
exit 1
|
||||
else
|
||||
log_success "Successfully uploaded pmd-*-${VERSION}.zip to sourceforge"
|
||||
fi
|
||||
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
elif [[ "${VERSION}" == *-SNAPSHOT ]]; then
|
||||
log_info "This is a snapshot build"
|
||||
./mvnw deploy -Possrh,sign $MVN_BUILD_FLAGS
|
||||
@ -70,6 +127,7 @@ elif travis_isPush; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Deploy to sourceforge files
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
@ -85,8 +143,18 @@ elif travis_isPush; then
|
||||
log_success "Successfully uploaded pmd-*-${VERSION}.zip to sourceforge"
|
||||
fi
|
||||
|
||||
if [[ "${VERSION}" != *-SNAPSHOT && "${TRAVIS_TAG}" != "" ]]; then
|
||||
# Since this is a release, making the binary the new default file...
|
||||
log_info "Selecting pmd-bin-${VERSION} as default on sourceforge.net..."
|
||||
curl -H "Accept: application/json" -X PUT -d "default=windows&default=mac&default=linux&default=bsd&default=solaris&default=others" \
|
||||
-d "api_key=${PMD_SF_APIKEY}" https://sourceforge.net/projects/pmd/files/pmd/${VERSION}/pmd-bin-${VERSION}.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Couldn't select latest binary as default on sourceforge.net"
|
||||
else
|
||||
log_info "pmd-bin-${VERSION} is now the default download option."
|
||||
fi
|
||||
fi
|
||||
)
|
||||
|
||||
( # UPLOAD RELEASE NOTES TO SOURCEFORGE
|
||||
|
||||
# This handler is called if any command fails
|
||||
|
@ -14,12 +14,6 @@ log_info "Building PMD Documentation ${VERSION} on branch ${TRAVIS_BRANCH}"
|
||||
./mvnw clean verify -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -P generate-rule-docs
|
||||
|
||||
|
||||
# in order to prevent that this documentation job is deploying the binary distributions to github releases
|
||||
# we delete it here
|
||||
|
||||
rm -f pmd-dist/target/pmd-*.zip
|
||||
|
||||
|
||||
|
||||
if ! travis_isPush; then
|
||||
log_info "Not publishing site, since this is not a push!"
|
||||
@ -44,6 +38,134 @@ zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
|
||||
log_success "Successfully created pmd-doc-${VERSION}.zip:"
|
||||
ls -lh pmd-doc-${VERSION}.zip
|
||||
|
||||
popd
|
||||
|
||||
if [[ "${VERSION}" != *-SNAPSHOT && "${TRAVIS_TAG}" != "" ]]; then
|
||||
# Deploy to github releases
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" 'https://api.github.com/repos/pmd/pmd/releases?per_page=1'|jq ".[0].id")
|
||||
RELEASE_DATA=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" "https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}")
|
||||
DRAFT=$(echo "$RELEASE_DATA"|jq ".draft")
|
||||
if [ "$DRAFT" != "true" ]; then
|
||||
REQUEST=$(cat <<EOF
|
||||
{
|
||||
"tag_name": "${TRAVIS_TAG}",
|
||||
"target_commitish": "$(git show-ref --hash HEAD)",
|
||||
"name": "${TRAVIS_TAG}",
|
||||
"draft": true
|
||||
}
|
||||
EOF
|
||||
)
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" \
|
||||
--data "${REQUEST}" -X POST https://api.github.com/repos/pmd/pmd/releases | jq ".id")
|
||||
echo $RELEASE_ID
|
||||
log_info "Created draft release with id ${RELEASE_ID}"
|
||||
else
|
||||
log_info "Using draft release with id "${RELEASE_ID}"
|
||||
fi
|
||||
UPLOAD_URL=$(echo "$RELEASE_DATA" | jq --raw-output ".upload_url")
|
||||
UPLOAD_URL=${UPLOAD_URL%%\{\?name,label\}}
|
||||
echo "Uploading docs/pmd-doc-${VERSION}.zip ..."
|
||||
curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/zip" \
|
||||
--data-binary "@docs/pmd-doc-${VERSION}.zip" \
|
||||
-X POST "${UPLOAD_URL}?name=pmd-doc-${VERSION}.zip"
|
||||
|
||||
# updating github release text
|
||||
# renders, and skips the first 6 lines - the Jekyll front-matter
|
||||
RENDERED_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
|
||||
|
||||
# Assumes, the release has already been created by travis github releases provider
|
||||
RELEASE_NAME="PMD ${VERSION} ($(date -u +%d-%B-%Y))"
|
||||
RELEASE_BODY="$RENDERED_RELEASE_NOTES"
|
||||
RELEASE_BODY="${RELEASE_BODY//'\'/\\\\}"
|
||||
RELEASE_BODY="${RELEASE_BODY//$'\r'/}"
|
||||
RELEASE_BODY="${RELEASE_BODY//$'\n'/\\r\\n}"
|
||||
RELEASE_BODY="${RELEASE_BODY//'"'/\\\"}"
|
||||
cat > release-edit-request.json <<EOF
|
||||
{
|
||||
"name": "$RELEASE_NAME",
|
||||
"body": "$RELEASE_BODY"
|
||||
}
|
||||
EOF
|
||||
echo -e "\n\n"
|
||||
log_info "Updating release at https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}..."
|
||||
|
||||
|
||||
RESPONSE=$(curl -i -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" --data "@release-edit-request.json" -X PATCH https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID})
|
||||
if [[ "$RESPONSE" != *"HTTP/1.1 200"* ]]; then
|
||||
log_error "Github Request failed!"
|
||||
echo "Request:"
|
||||
cat release-edit-request.json
|
||||
echo
|
||||
echo "Response:"
|
||||
echo "$RESPONSE"
|
||||
else
|
||||
log_success "Update OK"
|
||||
fi
|
||||
|
||||
echo -e "\n\n"
|
||||
log_info "Adding the new doc to pmd.github.io..."
|
||||
# clone pmd.github.io. Note: This uses the ssh key setup earlier
|
||||
# In order to speed things up, we use a sparse checkout - no need to checkout all directories here
|
||||
mkdir pmd.github.io
|
||||
(
|
||||
cd pmd.github.io
|
||||
git init
|
||||
git config user.name "Travis CI (pmd-bot)"
|
||||
git config user.email "andreas.dangel+pmd-bot@adangel.org"
|
||||
git config core.sparsecheckout true
|
||||
git remote add origin git@github.com:pmd/pmd.github.io.git
|
||||
echo "/latest/" > .git/info/sparse-checkout
|
||||
echo "/sitemap.xml" >> .git/info/sparse-checkout
|
||||
git pull --depth=1 origin master
|
||||
log_info "Copying documentation from ../docs/pmd-doc-${VERSION}/ to pmd-${VERSION}/ ..."
|
||||
rsync -ah --stats ../docs/pmd-doc-${VERSION}/ pmd-${VERSION}/
|
||||
git status
|
||||
echo "Executing: git add pmd-${VERSION}"
|
||||
git add pmd-${VERSION}
|
||||
echo "Executing: git commit..."
|
||||
git commit -q -m "Added pmd-${VERSION}"
|
||||
|
||||
log_info "Copying pmd-${VERSION} to latest ..."
|
||||
git rm -qr latest
|
||||
cp -a pmd-${VERSION} latest
|
||||
echo "Executing: git add latest"
|
||||
git add latest
|
||||
echo "Executing: git commit..."
|
||||
git commit -q -m "Copying pmd-${VERSION} to latest"
|
||||
|
||||
log_info "Generating sitemap.xml"
|
||||
../.travis/sitemap_generator.sh > sitemap.xml
|
||||
echo "Executing: git add sitemap.xml"
|
||||
git add sitemap.xml
|
||||
echo "Executing: git commit..."
|
||||
git commit -q -m "Generated sitemap.xml"
|
||||
|
||||
echo "Executing: git push origin master"
|
||||
git push origin master
|
||||
)
|
||||
|
||||
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
echo -e "\n\n"
|
||||
log_info "Uploading the new release to pmd.sourceforge.net which serves as an archive..."
|
||||
|
||||
.travis/travis_wait "rsync -ah --stats docs/pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/pmd-${VERSION}/"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Uploading documentation to pmd.sourceforge.net failed..."
|
||||
log_error "Please upload manually (PMD Version: ${VERSION})"
|
||||
else
|
||||
log_success "The documentation is now available under http://pmd.sourceforge.net/pmd-${VERSION}/"
|
||||
fi
|
||||
true
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
# Deploy to sourceforge files
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
@ -51,9 +173,9 @@ ls -lh pmd-doc-${VERSION}.zip
|
||||
if [[ "${TRAVIS_TAG}" != "" || "${VERSION}" == *-SNAPSHOT ]]; then
|
||||
echo -e "\n\n"
|
||||
log_info "Uploading pmd doc distribution to sourceforge..."
|
||||
../.travis/travis_wait "rsync -avh pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/"
|
||||
.travis/travis_wait "rsync -avh docs/pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/"
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Couldn't upload pmd-doc-${VERSION}.zip!"
|
||||
log_error "Couldn't upload docs/pmd-doc-${VERSION}.zip!"
|
||||
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd/"
|
||||
else
|
||||
log_success "Successfully uploaded pmd-doc-${VERSION}.zip to sourceforge"
|
||||
@ -61,10 +183,10 @@ ls -lh pmd-doc-${VERSION}.zip
|
||||
fi
|
||||
|
||||
# rsync site to pmd.sourceforge.net/snapshot
|
||||
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]] && has_docs_change; then
|
||||
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then
|
||||
echo -e "\n\n"
|
||||
log_info "Uploading snapshot site to pmd.sourceforge.net/snapshot..."
|
||||
../.travis/travis_wait "rsync -ah --stats --delete pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/"
|
||||
.travis/travis_wait "rsync -ah --stats --delete docs/pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/"
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Couldn't upload the snapshot documentation. It won't be current on http://pmd.sourceforge.net/snapshot/"
|
||||
else
|
||||
@ -81,14 +203,14 @@ ls -lh pmd-doc-${VERSION}.zip
|
||||
# Push the generated site to gh-pages branch
|
||||
# only for snapshot builds from branch master
|
||||
#
|
||||
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]] && has_docs_change; then
|
||||
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then
|
||||
echo -e "\n\n"
|
||||
log_info "Pushing the new site to github pages..."
|
||||
git clone --branch gh-pages --depth 1 git@github.com:pmd/pmd.git pmd-gh-pages
|
||||
# clear the files first
|
||||
rm -rf pmd-gh-pages/*
|
||||
# copy the new site
|
||||
cp -a pmd-doc-${VERSION}/* pmd-gh-pages/
|
||||
cp -a docs/pmd-doc-${VERSION}/* pmd-gh-pages/
|
||||
(
|
||||
cd pmd-gh-pages
|
||||
git config user.name "Travis CI (pmd-bot)"
|
||||
@ -104,4 +226,3 @@ TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}"
|
||||
)
|
||||
fi
|
||||
|
||||
popd
|
||||
|
@ -53,14 +53,3 @@ function travis_isWindows() {
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function has_docs_change() {
|
||||
if [[ $(git diff --name-only ${TRAVIS_COMMIT_RANGE}) = *"docs/"* ]]; then
|
||||
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): changes found"
|
||||
return 0
|
||||
else
|
||||
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): no changes"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@ -1,135 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source .travis/logger.sh
|
||||
|
||||
echo "BUILD: $BUILD"
|
||||
RELEASE_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
|
||||
echo "RELEASE_VERSION: $RELEASE_VERSION"
|
||||
|
||||
if [ "${BUILD}" = "deploy" ]; then
|
||||
|
||||
# Deploy to ossrh has already been done with the usual build. See build-deploy.sh
|
||||
|
||||
(
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
# The site has been built before, the files have already been uploaded to sourceforge.
|
||||
# Since this is a release, making the binary the new default file...
|
||||
log_info "Selecting pmd-bin-${RELEASE_VERSION} as default on sourceforge.net..."
|
||||
curl -H "Accept: application/json" -X PUT -d "default=windows&default=mac&default=linux&default=bsd&default=solaris&default=others" \
|
||||
-d "api_key=${PMD_SF_APIKEY}" https://sourceforge.net/projects/pmd/files/pmd/${RELEASE_VERSION}/pmd-bin-${RELEASE_VERSION}.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Couldn't select latest binary as default on sourceforge.net"
|
||||
else
|
||||
log_info "pmd-bin-${RELEASE_VERSION} is now the default download option."
|
||||
fi
|
||||
true
|
||||
)
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ "${BUILD}" = "doc" ]; then
|
||||
|
||||
echo -e "\n\n"
|
||||
log_info "Adding the new doc to pmd.github.io..."
|
||||
# clone pmd.github.io. Note: This uses the ssh key setup earlier
|
||||
# In order to speed things up, we use a sparse checkout - no need to checkout all directories here
|
||||
mkdir pmd.github.io
|
||||
(
|
||||
cd pmd.github.io
|
||||
git init
|
||||
git config user.name "Travis CI (pmd-bot)"
|
||||
git config user.email "andreas.dangel+pmd-bot@adangel.org"
|
||||
git config core.sparsecheckout true
|
||||
git remote add origin git@github.com:pmd/pmd.github.io.git
|
||||
echo "/latest/" > .git/info/sparse-checkout
|
||||
echo "/sitemap.xml" >> .git/info/sparse-checkout
|
||||
git pull --depth=1 origin master
|
||||
log_info "Copying documentation from ../docs/pmd-doc-${RELEASE_VERSION}/ to pmd-${RELEASE_VERSION}/ ..."
|
||||
rsync -ah --stats ../docs/pmd-doc-${RELEASE_VERSION}/ pmd-${RELEASE_VERSION}/
|
||||
git status
|
||||
echo "Executing: git add pmd-${RELEASE_VERSION}"
|
||||
git add pmd-${RELEASE_VERSION}
|
||||
echo "Executing: git commit..."
|
||||
git commit -q -m "Added pmd-${RELEASE_VERSION}"
|
||||
|
||||
log_info "Copying pmd-${RELEASE_VERSION} to latest ..."
|
||||
git rm -qr latest
|
||||
cp -a pmd-${RELEASE_VERSION} latest
|
||||
echo "Executing: git add latest"
|
||||
git add latest
|
||||
echo "Executing: git commit..."
|
||||
git commit -q -m "Copying pmd-${RELEASE_VERSION} to latest"
|
||||
|
||||
log_info "Generating sitemap.xml"
|
||||
../.travis/sitemap_generator.sh > sitemap.xml
|
||||
echo "Executing: git add sitemap.xml"
|
||||
git add sitemap.xml
|
||||
echo "Executing: git commit..."
|
||||
git commit -q -m "Generated sitemap.xml"
|
||||
|
||||
echo "Executing: git push origin master"
|
||||
git push origin master
|
||||
)
|
||||
|
||||
# renders, and skips the first 6 lines - the Jekyll front-matter
|
||||
RENDERED_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
|
||||
|
||||
# Assumes, the release has already been created by travis github releases provider
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" https://api.github.com/repos/pmd/pmd/releases/tags/pmd_releases/${RELEASE_VERSION}|jq ".id")
|
||||
RELEASE_NAME="PMD ${RELEASE_VERSION} ($(date -u +%d-%B-%Y))"
|
||||
RELEASE_BODY="$RENDERED_RELEASE_NOTES"
|
||||
RELEASE_BODY="${RELEASE_BODY//'\'/\\\\}"
|
||||
RELEASE_BODY="${RELEASE_BODY//$'\r'/}"
|
||||
RELEASE_BODY="${RELEASE_BODY//$'\n'/\\r\\n}"
|
||||
RELEASE_BODY="${RELEASE_BODY//'"'/\\\"}"
|
||||
cat > release-edit-request.json <<EOF
|
||||
{
|
||||
"name": "$RELEASE_NAME",
|
||||
"body": "$RELEASE_BODY",
|
||||
"draft": false
|
||||
}
|
||||
EOF
|
||||
echo -e "\n\n"
|
||||
log_info "Updating and publishing release at https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}..."
|
||||
|
||||
|
||||
RESPONSE=$(curl -i -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" --data "@release-edit-request.json" -X PATCH https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID})
|
||||
if [[ "$RESPONSE" != *"HTTP/1.1 200"* ]]; then
|
||||
log_error "Github Request failed!"
|
||||
echo "Request:"
|
||||
cat release-edit-request.json
|
||||
echo
|
||||
echo "Response:"
|
||||
echo "$RESPONSE"
|
||||
else
|
||||
log_success "Update OK"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
(
|
||||
echo -e "\n\n"
|
||||
|
||||
# disable fast fail, exit immediately, in this subshell
|
||||
set +e
|
||||
|
||||
log_info "Uploading the new release to pmd.sourceforge.net which serves as an archive..."
|
||||
|
||||
.travis/travis_wait "rsync -ah --stats docs/pmd-doc-${RELEASE_VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/pmd-${RELEASE_VERSION}/"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "Uploading documentation to pmd.sourceforge.net failed..."
|
||||
log_error "Please upload manually (PMD Version: ${RELEASE_VERSION})"
|
||||
else
|
||||
log_success "The documentation is now available under http://pmd.sourceforge.net/pmd-${RELEASE_VERSION}/"
|
||||
fi
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
fi
|
||||
|
Reference in New Issue
Block a user