nosqlbench/.github/workflows/release.yml

295 lines
9.5 KiB
YAML
Raw Normal View History

2020-03-13 02:50:44 -05:00
name: release
2020-03-04 11:26:22 -06:00
on:
push:
2020-05-05 20:53:24 -05:00
paths:
- RELEASENOTES.**
2020-03-04 11:26:22 -06:00
jobs:
2020-03-10 18:44:59 -05:00
release:
2020-03-10 02:56:07 -05:00
runs-on: ubuntu-18.04
2020-03-04 11:26:22 -06:00
steps:
2020-08-10 05:59:25 -05:00
2020-12-07 14:34:01 -06:00
- name: checkout repo
uses: actions/checkout@v2
- name: setup java
uses: actions/setup-java@v1
with:
2020-12-14 10:50:27 -06:00
java-version: '15'
2020-12-07 14:34:01 -06:00
java-package: jdk
architecture: x64
- name: avoid release loop
run: scripts/avoid-release-loop.sh
env:
GIT_RELEASE_BOT_NAME: "nb-droid"
- name: capture tty for gpg
run: |
echo "TTY="$(tty) >> $GITHUB_ENV
echo "GPG_TTY="$(tty) >> $GITHUB_ENV
# echo "::set-env name=TTY::"$(tty)
# echo "::set-env name=GPG_TTY::"$(tty)
- name: initialize gpg
run: |
set -x
echo "${{ secrets.GITHUB_GPG_KEY }}" | base64 -d > private.key
gpg --import --batch ./private.key
rm ./private.key
echo "gnupg files:"
ls -l ~/.gnupg/
- name: set git username
run: git config --global user.email "${{ secrets.NBDROID_EMAIL }}"
- name: set git email
run: git config --global user.name "${{ secrets.NBDROID_NAME }}"
2020-12-07 20:30:50 -06:00
2020-12-07 14:34:01 -06:00
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: read versions
run: |
set -x
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
RELEASE_VERSION=${CURRENT_VERSION%%-SNAPSHOT}
BASE_VERSION=$(echo "$RELEASE_VERSION" | cut -d'.' -f1-2)
MINOR_VERSION=$(echo "$RELEASE_VERSION" | cut -d'.' -f3)
NEXT_MINOR_VERSION=$(( MINOR_VERSION+1))
NEXT_SNAPSHOT="${BASE_VERSION}.${NEXT_MINOR_VERSION}-SNAPSHOT"
RELEASE_TAGNAME="nosqlbench-${RELEASE_VERSION}"
echo "NEXT_SNAPSHOT=${NEXT_SNAPSHOT}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "RELEASE_TAGNAME=${RELEASE_TAGNAME}" >> $GITHUB_ENV
# echo "::set-env name=NEXT_SNAPSHOT::${NEXT_SNAPSHOT}"
# echo "::set-env name=RELEASE_VERSION::${RELEASE_VERSION}"
# echo "::set-env name=RELEASE_TAGNAME::${RELEASE_TAGNAME}"
- name: prepare release summary
id: prepare_summary
run: |
#summary=$(scripts/release-notes.sh)
summary=$(cat RELEASENOTES.md)
summary="${summary//'%'/'%25'}"
summary="${summary//$'\n'/'%0A'}"
summary="${summary//$'\r'/'%0D'}"
echo "::set-output name=release_summary::$summary"
2020-12-07 20:30:50 -06:00
- name: select release type from branch name
run: |
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [[ ${current_branch} == *"main"* ]]
2020-12-07 20:30:50 -06:00
then
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "DOCKER_TAGS=nosqlbench/nosqlbench:latest,nosqlbench/nosqlbench:4x,nosqlbench/nosqlbench:${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
else
2020-12-07 20:30:50 -06:00
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "DOCKER_TAGS=nosqlbench/nosqlbench:nb4preview,nosqlbench/nosqlbench:${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
2020-12-07 20:30:50 -06:00
fi
- name: prepare Maven release
2020-12-07 14:34:01 -06:00
run: scripts/release-prepare.sh
env:
RELEASE_BRANCH_PATTERN: "main"
PRERELEASE_BRANCH_PATTERN: "prerelease"
2020-12-07 14:34:01 -06:00
GIT_RELEASE_BOT_NAME: "nb-droid"
GIT_RELEASE_BOT_EMAIL: ${{ secrets.GIT_RELEASE_BOT_EMAIL }}
ACCESS_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
GPG_ENABLED: "true"
GPG_KEY_ID: ${{ secrets.GITHUB_GPG_KEY_ID }}
GPG_KEY: ${{ secrets.GITHUB_GPG_KEY }}
GPG_SERVER_NAME: ${{ secrets.GPG_SERVER_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_REPO_SERVER_ID: ${{ secrets.MAVEN_REPO_SERVER_ID }}
MAVEN_REPO_SERVER_USERNAME: ${{ secrets.MVN_REPO_PRIVATE_REPO_USER }}
MAVEN_REPO_SERVER_PASSWORD: ${{ secrets.MVN_REPO_PRIVATE_REPO_PASSWORD }}
2020-12-07 20:30:50 -06:00
- name: Setup docker buildx
uses: docker/setup-buildx-action@v1
- name: docker hub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: docker test build
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
pull: true
push: false
load: true
tags: ${{ env.DOCKER_TAGS }}
- name: sanity check docker image
run: |
docker run --rm nosqlbench/nosqlbench:${{ env.RELEASE_VERSION }} --version
2020-12-07 14:34:01 -06:00
- name: bundle integration test logs
run: |
pwd
find nb
mkdir -p itlogs/nb
cp -R nb/logs itlogs/nb
- name: upload integration test logs
uses: actions/upload-artifact@v1
with:
name: itlogs
path: itlogs
2020-12-07 20:30:50 -06:00
- name: perform Maven release
2020-12-07 14:34:01 -06:00
run: scripts/release-perform.sh
continue-on-error: true
env:
RELEASE_BRANCH_PATTERN: "main"
PRERELEASE_BRANCH_PATTERN: "prerelease"
2020-12-07 14:34:01 -06:00
GIT_RELEASE_BOT_NAME: "nb-droid"
GIT_RELEASE_BOT_EMAIL: ${{ secrets.GIT_RELEASE_BOT_EMAIL }}
ACCESS_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
GPG_ENABLED: "true"
GPG_KEY_ID: ${{ secrets.GITHUB_GPG_KEY_ID }}
GPG_KEY: ${{ secrets.GITHUB_GPG_KEY }}
GPG_SERVER_NAME: ${{ secrets.GPG_SERVER_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_REPO_SERVER_ID: ${{ secrets.MAVEN_REPO_SERVER_ID }}
MAVEN_REPO_SERVER_USERNAME: ${{ secrets.MVN_REPO_PRIVATE_REPO_USER }}
MAVEN_REPO_SERVER_PASSWORD: ${{ secrets.MVN_REPO_PRIVATE_REPO_PASSWORD }}
- name: bundle artifacts
run: |
pwd
ls -l
mkdir staging
cp nb/target/nb.jar nb/target/nb staging
- name: upload artifacts
uses: actions/upload-artifact@v1
with:
name: binaries
path: staging
2020-12-07 20:30:50 -06:00
- name: docker push to hub
2020-12-07 14:34:01 -06:00
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
pull: true
push: true
tags: ${{ env.DOCKER_TAGS }}
- name: bundle guidebook
run: mkdir guidebook && cp -R nb/target/guidebook guidebook
- name: upload guidebook
uses: actions/upload-artifact@v1
with:
name: guidebook
path: guidebook
2020-12-07 20:30:50 -06:00
- name: create github release
id: create_github_release
2020-12-07 14:34:01 -06:00
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_TAGNAME }}
release_name: Release ${{ env.RELEASE_TAGNAME }}
draft: false
prerelease: ${{ env.PRERELEASE }}
body: ${{ steps.prepare_summary.outputs.release_summary }}
2020-12-07 20:30:50 -06:00
- name: upload nb.jar to github release
2020-12-07 14:34:01 -06:00
id: upload-nb-jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2020-12-07 20:30:50 -06:00
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
2020-12-07 14:34:01 -06:00
asset_path: nb/target/nb.jar
asset_name: nb.jar
asset_content_type: application/octet-stream
2020-12-07 20:30:50 -06:00
- name: upload nb binary to github release
2020-12-07 14:34:01 -06:00
id: upload-nb-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2020-12-07 20:30:50 -06:00
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
2020-12-07 14:34:01 -06:00
asset_path: nb/target/nb
asset_name: nb
asset_content_type: application/octet-stream
2020-03-19 13:13:17 -05:00
2020-03-12 04:29:01 -05:00
docs:
needs: release
runs-on: ubuntu-18.04
steps:
2020-05-21 16:37:00 -05:00
2020-12-07 14:34:01 -06:00
- name: set git username
run: git config --global user.email "${{ secrets.NBDROID_EMAIL }}"
- name: set git email
run: git config --global user.name "${{ secrets.NBDROID_NAME }}"
- name: download guidebook
uses: actions/download-artifact@v1
with:
name: guidebook
path: guidebook
- run: ls -la
- name: clone nosqlbench-docs
env:
NBDROID_NAME: ${{ secrets.NBDROID_NAME }}
NBDROID_TOKEN: ${{ secrets.NBDROID_TOKEN }}
run: |
git clone https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-docs.git nosqlbench-docs
cd nosqlbench-docs
echo "files listing"
find .
git remote set-url origin https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-docs.git
git remote -v
- name: push changes
env:
NBDROID_NAME: ${{ secrets.NBDROID_NAME }}
NBDROID_TOKEN: ${{ secrets.NBDROID_TOKEN }}
run: |
rsync -av --delete guidebook/guidebook/ nosqlbench-docs/docs/
echo "docs.nosqlbench.io" > nosqlbench-docs/docs/CNAME
cd nosqlbench-docs
git add docs
git add -u
CHANGES=$(git status --porcelain 2>/dev/null| wc -l)
echo "found $CHANGES to push for doc updates"
if (( $CHANGES > 0 ))
then
git commit -m"docs update for $GITHUB_REF"
git push
fi
2020-05-05 20:53:24 -05:00