Move to gh actions
This commit is contained in:
parent
ed4ea9357a
commit
78d3d016cf
46
.github/workflows/maven-publish.yml
vendored
Normal file
46
.github/workflows/maven-publish.yml
vendored
Normal file
@ -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 }}
|
70
Jenkinsfile
vendored
70
Jenkinsfile
vendored
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>it.tdlight</groupId>
|
||||
<artifactId>tdlib-session-container</artifactId>
|
||||
<version>4.0.${revision}</version>
|
||||
<version>4.1.${revision}</version>
|
||||
<name>TDLib Session Container</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
Loading…
x
Reference in New Issue
Block a user