-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #876 from lensesio/feat/include-release-process
feat: introduce release process as gh workflow
- Loading branch information
Showing
2 changed files
with
136 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Publish New Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
validate-tag: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
draft_release: ${{ steps.get_tag.outputs.draft_release }} | ||
tag: ${{ steps.get_tag.outputs.tag }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get tag, release mode | ||
shell: bash | ||
id: get_tag | ||
run: | | ||
if [[ ${GITHUB_REF##*/} =~ ^[0-9]\.[0-9]\.[0-9]$ ]]; | ||
then | ||
draft_release=false | ||
elif [[ ${GITHUB_REF##*/} =~ ^[0-9]\.[0-9]\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?(\+[A-Za-z0-9.]+)?$ ]]; | ||
then | ||
draft_release=true | ||
else | ||
echo "Existing, github ref needs to be a tag with format x.y.z or x.y.z+(alpha|beta|rc)" | ||
exit 1 | ||
fi | ||
echo "::set-output name=draft_release::$draft_release" | ||
echo "::set-output name=tag::${GITHUB_REF##*/}" | ||
build: | ||
needs: | ||
- validate-tag | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
version: ${{ needs.validate-tag.outputs.tag }} | ||
secrets: inherit | ||
|
||
create-release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- validate-tag | ||
- build | ||
strategy: | ||
matrix: | ||
module: ${{fromJSON(needs.build.outputs.modules)}} | ||
env: | ||
DRAFT_RELEASE: '${{ needs.validate-tag.outputs.draft_release }}' | ||
TAG: ${{ needs.validate-tag.outputs.tag }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
|
||
- name: Cache SBT | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.ivy2/cache | ||
~/.sbt | ||
key: ${{ runner.os }}-sbt-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/**') }} | ||
|
||
- name: Cache assembly | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/**/target/**/libs/*.jar | ||
key: ${{ runner.os }}-assembly-${{ matrix.module }}-${{ github.run_id }} | ||
|
||
- name: Package Connector | ||
shell: bash | ||
run: | | ||
FOLDER=kafka-connect-${{ matrix.module }}-${{ env.TAG }} | ||
mkdir -p $FOLDER | ||
cp **/target/**/libs/*.jar LICENSE $FOLDER/ | ||
zip -r "$FOLDER.zip" $FOLDER/ | ||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
file: kafka-connect-${{ matrix.module }}-${{ env.TAG }}.zip | ||
asset_name: "kafka-connect-${{ matrix.module }}-${{ env.TAG }}.zip" | ||
release_name: 'Stream Reactor ${{ env.TAG }}' | ||
prerelease: ${{ env.DRAFT_RELEASE }} |