nosqlbench/.github/workflows/release.yml
2020-03-13 02:50:44 -05:00

150 lines
5.1 KiB
YAML

name: release
on:
push:
branches:
- releases
jobs:
release:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12'
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
run: |
echo "::set-env name=TTY::"$(tty)
echo "::set-env name=GPG_TTY::"$(tty)
- name: initialize gpg
# env:
# GPG_TTY: ${TTY}
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: 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"
echo "::set-env name=NEXT_SNAPSHOT::${NEXT_SNAPSHOT}"
echo "::set-env name=RELEASE_VERSION::${RELEASE_VERSION}"
- name: prepare release
run: scripts/release-prepare.sh
env:
RELEASE_BRANCH_NAME: "releases"
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: perform release
run: scripts/release-perform.sh
env:
RELEASE_BRANCH_NAME: "releases"
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: prepare_release
# run: mvn --global-settings deploy.xml --batch-mode clean release:prepare -DdevelopmentVersion=${NEXT_SNAPSHOT} -DreleaseVersion=${RELEASE_VERSION}
# - name: perform_release
# run: mvn --global-settings deploy.xml --batch-mode release:perform
- name: upload artifacts
run: |
pwd
ls -l
mkdir staging && cp nb/target/nb.jar nb/target/nb staging
- uses: actions/upload-artifact@v1
with:
name: binaries
path: staging
- name: upload guidebook
run: mkdir guidebook && cp -R nb/target/guidebook guidebook
- uses: actions/upload-artifact@v1
with:
name: guidebook
path: guidebook
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
git remote set-url origin https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-docs.git
- name: push changes
run: |
rsync -av --delete guidebook/ nosqlbench-docs/docs/
cd nosqlbench-docs
git add docs
git add -u
git commit -m"docs update for $GITHUB_REF"
git push