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 name: preview
# This workflow should run for any push which is a preview build. # 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: # 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: on:
push: push:
@ -138,7 +141,7 @@ jobs:
draft: false draft: false
prerelease: true prerelease: true
generate_release_notes: true generate_release_notes: true
name: Release ${{ env.PREVIEW_VERSION }} name: Preview ${{ env.PREVIEW_VERSION }}
fail_on_unmatched_files: true fail_on_unmatched_files: true
tag_name: ${{ env.PREVIEW_VERSION }} tag_name: ${{ env.PREVIEW_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

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

View File

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