sync preview and release logic

This commit is contained in:
Jonathan Shook 2023-01-26 00:53:32 -06:00
parent 2e85f21a79
commit 56be33ae92
4 changed files with 101 additions and 82 deletions

View File

@ -1,9 +1,12 @@
name: preview
# This workflow should run for any push which is a preview build.
# Preview builds are indicated with changes to PREVIEW_NOTES.md.
# Preview builds are indicated with a tag that ends in -preview
# In order to effect this, you can do the following:
# scripts/release-notes.sh > PREVIEW_NOTES.md
# scripts/tag-preview-build
# If you want to replace a build, you can use -f and then
# push the update to the tag like push -f origin <tag>,
# although this should never be done!
on:
push:
@ -138,7 +141,7 @@ jobs:
draft: false
prerelease: true
generate_release_notes: true
name: Release ${{ env.PREVIEW_VERSION }}
name: Preview ${{ env.PREVIEW_VERSION }}
fail_on_unmatched_files: true
tag_name: ${{ env.PREVIEW_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,9 +1,12 @@
name: release
# This workflow should run for any push which is a preview build.
# Preview builds are indicated with changes to PREVIEW_NOTES.md.
# This workflow should run for any push which is a release build.
# Release builds are indicated with a tag that ends in -release
# In order to effect this, you can do the following:
# scripts/release-notes.sh > RELEASE_NOTES.md
# scripts/tag-release-build
# If you want to replace a build, you can use -f and then
# push the update to the tag like push -f origin <tag>,
# although this should never be done!
on:
push:
@ -17,13 +20,10 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3
with:
node-version: '16'
- name: setup java
uses: actions/setup-java@v3
with:
node-version: '16'
distribution: 'temurin'
java-version: '17'
java-package: jdk
@ -44,9 +44,8 @@ jobs:
df -h
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3.2.3
with:
node-version: '16'
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
@ -54,30 +53,28 @@ jobs:
- name: read versions
run: |
set -x
RELEASE_REVISION=$(scripts/get-release-version.sh)
echo "RELEASE_REVISION=${RELEASE_REVISION}" >> $GITHUB_ENV
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${RELEASE_REVISION},nosqlbench/nosqlbench:latest" >> $GITHUB_ENV
RELEASE_VERSION=$(scripts/get-release-version.sh)
RELEASE_VERSION_NUMERIC=$(scripts/get-release-version.sh -n)
RELEASE_VERSION_SHORT=$(scripts/get-release-version.sh -s)
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${RELEASE_VERSION_NUMERIC},nosqlbench/nosqlbench:${RELEASE_VERSION_SHORT}-latest" >> $GITHUB_ENV
- name: build release revision
run: |
mvn clean package -Drevision="${{ env.RELEASE_REVISION }}"
mvn clean package -Drevision="${{ env.RELEASE_VERSION }}"
- name: Setup docker buildx
uses: docker/setup-buildx-action@v1
with:
node-version: '16'
uses: docker/setup-buildx-action@v2.2.1
- name: docker hub login
uses: docker/login-action@v1
uses: docker/login-action@v2.1.0
with:
node-version: '16'
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: docker test build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3.3.0
with:
node-version: '16'
context: .
file: Dockerfile
pull: true
@ -87,7 +84,7 @@ jobs:
- name: sanity check docker image
run: |
docker run --rm nosqlbench/nosqlbench:${{ env.RELEASE_REVISION }} --version
docker run --rm nosqlbench/nosqlbench:${{ env.RELEASE_VERSION }} --version
- name: bundle artifacts
run: |
@ -99,40 +96,26 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v1
with:
node-version: '16'
name: binaries
path: staging
# - name: generate javadoc
# run: mvn javadoc:aggregate-jar
# continue-on-error: false
#
# - name: upload javadoc
# uses: actions/upload-artifact@v3
# with:
# name: javadoc
# path: target/nosqlbench-*-javadoc.jar
# - name: generate javadoc
# run: mvn javadoc:aggregate-jar
# continue-on-error: false
#
# - name: upload javadoc
# uses: actions/upload-artifact@v3
# with:
# name: javadoc
# path: target/nosqlbench-*-javadoc.jar
- name: prepare release summary
id: prepare_summary
- name: bump minor version
run: |
#summary=$(scripts/release-notes.sh)
summary=$(cat RELEASE_NOTES.md)
summary="${summary//'%'/'%25'}"
summary="${summary//$'\n'/'%0A'}"
summary="${summary//$'\r'/'%0D'}"
echo "release_summary=$summary" >> $GITHUB_STATE
- name: tag release
run: |
git tag nb5-${{ env.RELEASE_REVISION }}
git tag -f nb5-release
git push --tags
scripts/bump-minor-version
- name: docker push to hub
uses: docker/build-push-action@v2
with:
node-version: '16'
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
@ -140,48 +123,62 @@ jobs:
push: true
tags: ${{ env.DOCKER_TAGS }}
# https://github.com/softprops/action-gh-release
- name: create github release
id: create_github_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v0.1.15
if: startsWith(github.ref, 'refs/tags/')
with:
node-version: '16'
tag_name: ${{ env.RELEASE_REVISION }}
release_name: Release ${{ env.RELEASE_REVISION }}
# body: ${{ steps.prepare_summary.outputs.release_summary }}
# body_path: PREVIEW_NOTES.md
draft: false
prerelease: true
body: ${{ steps.prepare_summary.outputs.release_summary }}
generate_release_notes: true
name: Release ${{ env.RELEASE_VERSION }}
fail_on_unmatched_files: true
tag_name: ${{ env.RELEASE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
nb5/target/nb5
nb5/target/nb5.jar
- name: upload nb.jar to github release
id: upload-nb-jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version: '16'
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
asset_path: nb5/target/nb5.jar
asset_name: nb5.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:
node-version: '16'
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
asset_path: nb5/target/nb5
asset_name: nb5
asset_content_type: application/octet-stream
# - name: create github release
# id: create_github_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.RELEASE_VERSION }}
# release_name: Release ${{ env.RELEASE_VERSION }}
# draft: false
# prerelease: true
# 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: nb5/target/nb5.jar
# asset_name: nb5.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: nb5/target/nb5
# asset_name: nb5
# asset_content_type: application/octet-stream
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
with:
node-version: '16'
name: test-results
path: |
[a-zA-Z]**/logs/*

View File

@ -15,6 +15,12 @@
# limitations under the License.
#
if [ "$1" == "-n" ]
then numeric=true
elif [ "$1" == "-s" ]
then short=true
fi
set -e
export REVISION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)
@ -49,6 +55,14 @@ else
exit 5
fi
printf "%s.%s.%s-release\n" "${@:2:3}"
if [ "$numeric" == "true" ]
then
printf "%s.%s.%s\n" "${@:2:3}"
elif [ "$short" == "true" ]
then
printf "%s.%s\n" "${@:2:2}"
else
printf "%s.%s.%s-release\n" "${@:2:3}"
fi

View File

@ -6,5 +6,10 @@ RELEASE_VERSION=${CURRENT_VERSION%%-SNAPSHOT}
RELEASE_TAG="${RELEASE_VERSION}-release"
printf "release tag: '%s'\n" "${RELEASE_TAG}"
git tag "${RELEASE_TAG}"
if [ "$1" == "-f" ]
then
git tag -f "${RELEASE_TAG}"
else
git tag "${RELEASE_TAG}"
fi