Настройка CICD

This commit is contained in:
Struchkov Mark 2022-12-18 17:07:52 +03:00
parent 3637599e0c
commit 8e1090c608
3 changed files with 61 additions and 26 deletions

View File

@ -17,32 +17,15 @@ steps:
from_secret: MAVEN_SETTINGS from_secret: MAVEN_SETTINGS
GPG_PASSPHRASE: GPG_PASSPHRASE:
from_secret: GPG_PASSPHRASE from_secret: GPG_PASSPHRASE
SSH_KEY:
from_secret: SSH_KEY
commands: commands:
- eval $(ssh-agent -s) - echo "$GPG_PRIVATE_KEY" >> gpg.key
- mkdir -p ~/.ssh - echo "$MAVEN_SETTINGS" >> maven-settings.xml
- chmod 700 ~/.ssh - gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
- echo "$SSH_KEY" | ssh-add - - mvn --settings maven-settings.xml -U -P ossrh,release clean deploy
- ssh-keyscan -p 222 git.struchkov.dev >> ~/.ssh/known_hosts
- git branch -a
# - echo "test" >> test.txt
# - git add --all
# - git commit -m test
# - git remote add deploy ssh://git@git.struchkov.dev:222/Godfather-Bots/godfather.git
# - git remote -v
# - git push deploy HEAD:master
# - ssh-keyscan -t rsa git.struchkov.dev >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# - echo "$GPG_PRIVATE_KEY" >> gpg.key
# - echo "$MAVEN_SETTINGS" >> maven-settings.xml
# - gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
# - mvn --settings maven-settings.xml -T 1C -U release:clean release:prepare release:perform --batch-mode
trigger: trigger:
branch: ref:
- master - refs/tags/v.*.*.*
volumes: volumes:
- name: m2 - name: m2

50
.drone.yml.back Normal file
View File

@ -0,0 +1,50 @@
kind: pipeline
type: docker
name: haiti-framework
steps:
- name: publish maven central
image: maven:3.8.5-openjdk-17
privileged: true
volumes:
- name: m2
path: /root/.m2/repository
environment:
GPG_PRIVATE_KEY:
from_secret: GPG_PRIVATE_KEY
MAVEN_SETTINGS:
from_secret: MAVEN_SETTINGS
GPG_PASSPHRASE:
from_secret: GPG_PASSPHRASE
SSH_KEY:
from_secret: SSH_KEY
commands:
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KEY" | ssh-add -
- ssh-keyscan -p 222 git.struchkov.dev >> ~/.ssh/known_hosts
- git branch -a
# - echo "test" >> test.txt
# - git add --all
# - git commit -m test
# - git remote add deploy ssh://git@git.struchkov.dev:222/Godfather-Bots/godfather.git
# - git remote -v
# - git push deploy HEAD:master
# - ssh-keyscan -t rsa git.struchkov.dev >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# - echo "$GPG_PRIVATE_KEY" >> gpg.key
# - echo "$MAVEN_SETTINGS" >> maven-settings.xml
# - gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
# - mvn --settings maven-settings.xml -T 1C -U release:clean release:prepare release:perform --batch-mode
trigger:
branch:
- master
volumes:
- name: m2
host:
path: /drone/volume/m2

View File

@ -49,6 +49,7 @@
<plugin.maven.source.ver>3.2.1</plugin.maven.source.ver> <plugin.maven.source.ver>3.2.1</plugin.maven.source.ver>
<plugin.maven.javadoc.ver>3.4.0</plugin.maven.javadoc.ver> <plugin.maven.javadoc.ver>3.4.0</plugin.maven.javadoc.ver>
<plugin.maven.gpg.ver>3.0.1</plugin.maven.gpg.ver> <plugin.maven.gpg.ver>3.0.1</plugin.maven.gpg.ver>
<plugin.maven.release.ver>3.0.0-M7</plugin.maven.release.ver>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -220,12 +221,13 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M7</version> <version>${plugin.maven.release.ver}</version>
<configuration> <configuration>
<preparationGoals>clean install</preparationGoals> <preparationGoals>clean compile</preparationGoals>
<goal>install</goal>
<tagNameFormat>v.@{project.version}</tagNameFormat> <tagNameFormat>v.@{project.version}</tagNameFormat>
<releaseProfiles>release,ossrh</releaseProfiles> <releaseProfiles>release,ossrh</releaseProfiles>
<pushChanges>true</pushChanges> <pushChanges>false</pushChanges>
<localCheckout>true</localCheckout> <localCheckout>true</localCheckout>
</configuration> </configuration>
</plugin> </plugin>