diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..023e679 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,46 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path + +name: Maven Package + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + build: + strategy: + matrix: + include: + - { os: ubuntu-20.04, arch: "linux/amd64" } + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: "recursive" + - name: Setup variables + shell: bash + run: | + # ====== Variables + export REVISION=${{ github.run_number }} + + echo "REVISION=$REVISION" >> $GITHUB_ENV + - name: Set up JDK 15 + if: github.ref == 'refs/heads/master' + uses: actions/setup-java@v1 + with: + java-version: 15 + server-id: mchv-release-distribution + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Deploy to Maven (Release) + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "REVISION: $REVISION" + mvn -B -Drevision=${REVISION} clean deploy --file pom.xml + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 7b91615..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env groovy -// see https://jenkins.io/doc/book/pipeline/syntax/ - -pipeline { - environment { - MVN_SET = credentials('maven_settings') - JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven' - } - agent any - options { - timestamps() - ansiColor("xterm") - } - parameters { - booleanParam(name: "RELEASE", - description: "Build a release from current commit.", - defaultValue: false) - } - stages { - stage("Setup workspace") { - agent none - steps { - sh "mkdir -p \"/var/jenkins_cache/.m2\"" - sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\"" - sh "mkdir -p \"/var/jenkins_cache/.ccache\"" - sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\"" - } - } - - stage("Build & Deploy SNAPSHOT") { - agent { - docker { - image 'maven:3.6.3-openjdk-11' - args '-v $HOME:/var/maven' - reuseNode true - } - } - steps { - sh "mvn -s $MVN_SET -B deploy" - } - } - - stage("Release") { - agent { - docker { - image 'maven:3.6.3-openjdk-11' - args '-v $HOME:/var/maven' - reuseNode true - } - } - when { - expression { params.RELEASE } - } - steps { - sh "git config user.email \"jenkins@mchv.eu\"" - sh "git config user.name \"Jenkins\"" - sh "cd ${workspace}" - sh "git add --all || true" - sh "git commit -m \"Add generated files\" || true" - sh "mvn -B -s $MVN_SET -Drevision=${BUILD_NUMBER} clean deploy" - } - } - } - post { - always { - /* clean up directory */ - deleteDir() - } - } -} diff --git a/pom.xml b/pom.xml index 8a0f7e0..a3c52bf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 it.tdlight tdlib-session-container - 4.0.${revision} + 4.1.${revision} TDLib Session Container UTF-8