mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-25 10:10:32 -06:00
296 lines
9.7 KiB
YAML
296 lines
9.7 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- nb5-preview
|
|
paths:
|
|
- RELEASENOTES.**
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
|
|
- name: checkout repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: setup java
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: '17'
|
|
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 }}"
|
|
|
|
|
|
- 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@v2
|
|
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"
|
|
|
|
- name: select release type from branch name
|
|
run: |
|
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
if [[ ${current_branch} == *"nb4-maintenance"* ]]
|
|
then
|
|
echo "PRERELEASE=false" >> $GITHUB_ENV
|
|
echo "DOCKER_TAGS=nosqlbench/nosqlbench:latest,nosqlbench/nosqlbench:4x,nosqlbench/nosqlbench:${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
|
|
else
|
|
echo "PRERELEASE=true" >> $GITHUB_ENV
|
|
echo "DOCKER_TAGS=nosqlbench/nosqlbench:nb4preview,nosqlbench/nosqlbench:${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: prepare Maven release
|
|
run: scripts/release-prepare.sh
|
|
env:
|
|
RELEASE_BRANCH_PATTERN: "nb4-maintenance"
|
|
PRERELEASE_BRANCH_PATTERN: "nb5-preview"
|
|
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: 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
|
|
|
|
# - 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
|
|
|
|
- name: perform Maven release
|
|
run: scripts/release-perform.sh
|
|
continue-on-error: true
|
|
env:
|
|
RELEASE_BRANCH_PATTERN: "nb4-maintenance"
|
|
PRERELEASE_BRANCH_PATTERN: "nb5-preview"
|
|
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
|
|
|
|
- name: docker push to hub
|
|
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
|
|
#
|
|
|
|
- name: create github release
|
|
id: create_github_release
|
|
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 }}
|
|
|
|
- name: upload nb.jar to github release
|
|
id: upload-nb-jar
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
|
|
asset_path: nb/target/nb.jar
|
|
asset_name: nb.jar
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: upload nb binary to github release
|
|
id: upload-nb-binary
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
|
|
asset_path: nb/target/nb
|
|
asset_name: nb
|
|
asset_content_type: application/octet-stream
|
|
|
|
# docs:
|
|
# needs: release
|
|
# runs-on: ubuntu-18.04
|
|
# steps:
|
|
#
|
|
# - 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
|
|
#
|
|
# Disabling this because it will be replaced soon.
|
|
# - 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
|
|
|
|
|
|
|