RESOLVED #7988: Cachedb-import: Exportación #41
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
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
release: | |
types: | |
- released | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Version | |
id: set-version | |
run: | | |
set -x | |
VERSION=$(sed -nr 's/version ?= ?([^-]*).*/\1/p' gradle.properties) | |
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | |
git tag -l | cat | |
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "$VERSION.*" | sed "s/$VERSION//" | sort -nt. -k2 2>/dev/null | tail -1 | rev | cut -d. -f1 | rev)+1)) | |
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }} | |
NAME=$(sed -nr 's/rootProject.name ?= ?"?([^"]*)"?/\1/p' settings.gradle)-$VERSION | |
echo version=$VERSION >> $GITHUB_OUTPUT | |
echo name=$NAME >> $GITHUB_OUTPUT | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Build with Gradle | |
run: ./gradlew -Pversion="${{ steps.set-version.outputs.version }}" build | |
- name: Publish asset | |
if: (github.event_name != 'pull_request') | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ steps.set-version.outputs.version }} | |
prerelease: ${{ github.event_name != 'release' }} | |
files: build/libs/${{ steps.set-version.outputs.name }}.jar | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
if: env.dockerhub_username != '' && env.dockerhub_token != '' && github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
if: env.dockerhub_username != '' && env.dockerhub_token != '' && github.event_name != 'pull_request' | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
if: env.dockerhub_username != '' && env.dockerhub_token != '' && github.event_name != 'pull_request' | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Docker image | |
if: env.dockerhub_username != '' && env.dockerhub_token != '' && github.event_name != 'pull_request' | |
run: | | |
mkdir plugins | |
IMAGE=litesolutions/jenkins-objectscriptquality | |
[ $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 -f jenkins/Dockerfile . | |
release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Bump release | |
run: | | |
VERSION=${{ github.event.release.tag_name }} | |
NEXT_VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.` | |
git config --global user.name 'ProjectBot' | |
git config --global user.email '[email protected]' | |
sed -i -r "s/(version ?= ?).*/\1${NEXT_VERSION}-SNAPSHOT/" gradle.properties | |
git add gradle.properties | |
git commit -m 'auto bump version with release' | |
git push |