-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
if: github.event_name == 'release' | ||
with: | ||
ref: main | ||
- uses: actions/checkout@v3 | ||
if: github.event_name != 'release' | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Set Version | ||
id: set-version | ||
run: | | ||
VERSION=$(sed -n 's|.*<version.trino>\(.*\)</version.trino>.*|\1|p' pom.xml | cut -d- -f1) | ||
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | ||
git tag -l | cat | ||
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }} | ||
[ $GITHUB_EVENT_NAME != 'release' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 -k5 2>/dev/null | tail -1 | rev | cut -d. -f1 | rev)+1)) | ||
NAME=trino-iris-$VERSION | ||
echo version=$VERSION >> $GITHUB_OUTPUT | ||
echo trino_version=${VERSION:0:3} >> $GITHUB_OUTPUT | ||
echo name=$NAME >> $GITHUB_OUTPUT | ||
./mvnw versions:set-property -Dproperty=version.trino -DnewVersion=${VERSION:0:3} | ||
./mvnw versions:set-property -Dproperty=revision -DnewVersion=${VERSION} | ||
- name: Build with Maven | ||
run: ./mvnw -DskipTests package | ||
- name: Publish Test Report | ||
if: ${{ always() }} | ||
uses: scacap/action-surefire-report@v1 | ||
- name: Update Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: v${{ steps.set-version.outputs.version }} | ||
prerelease: ${{ github.event_name != 'release' }} | ||
files: target/${{ steps.set-version.outputs.name }}.tar.gz | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
- name: Docker image | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
IMAGE=caretdev/trino-iris | ||
[ $GITHUB_EVENT_NAME == 'release' ] && TAGS="-t ${IMAGE}:latest -t ${IMAGE}:${{ steps.set-version.outputs.version }}" | ||
[ $GITHUB_EVENT_NAME == 'push' ] && TAGS="-t ${IMAGE}:beta" | ||
docker buildx build --platform linux/arm64,linux/amd64 ${TAGS} --push . |