-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from shubham17998/master
[MOSIP-34814] added pushtrigger
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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,109 @@ | ||
|
||
name: Maven Package upon a push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
- release* | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NFIQ_SERVICE_LOCATION: nfiq | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
ref: ${{ github.ref }} | ||
java-version: 11 | ||
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
||
- name: Setup branch and GPG public key | ||
run: | | ||
# Strip git ref prefix from version | ||
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV | ||
echo ${{ env.BRANCH_NAME }} | ||
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | ||
echo ${{ env.GPG_TTY }} | ||
sudo apt-get --yes install gnupg2 | ||
gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg | ||
gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven-${{ env.BRANCH_NAME }} | ||
- name: Install xmllint | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libxml2-utils | ||
- name: Setup the settings file for ossrh server | ||
run: echo "<settings> <servers> <server> <id>ossrh</id> <username>${{secrets.RELEASE_USER}}</username> <password>${{secrets.RELEASE_TOKEN}}</password> </server> </servers> <profiles> <profile> <id>ossrh</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <gpg.executable>gpg2</gpg.executable> <gpg.passphrase>${{secrets.gpg_secret}}</gpg.passphrase> </properties> </profile> <profile> <id>allow-snapshots</id> <activation><activeByDefault>true</activeByDefault></activation> <repositories> <repository> <id>snapshots-repo</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>releases-repo</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> </profile> </profiles> </settings>" > $GITHUB_WORKSPACE/settings.xml | ||
|
||
|
||
- name: Build nfiq with Maven | ||
run: | | ||
cd ./${{ env.NFIQ_SERVICE_LOCATION }} | ||
mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml | ||
publish_to_nexus_nfiq: | ||
runs-on: ubuntu-latest | ||
env: | ||
NFIQ_SERVICE_LOCATION: nfiq | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
ref: ${{ github.ref }} | ||
java-version: 11 | ||
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
|
||
- name: Setup branch and GPG public key | ||
run: | | ||
# Strip git ref prefix from version | ||
echo ${{ env.BRANCH_NAME }} | ||
echo ${{ env.GPG_TTY }} | ||
sudo apt-get --yes install gnupg2 | ||
gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg | ||
gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven-${{ env.BRANCH_NAME }} | ||
- name: Install xmllint | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libxml2-utils | ||
- name: Setup the settings file for ossrh server | ||
run: echo "<settings> <servers> <server> <id>ossrh</id> <username>${{secrets.RELEASE_USER}}</username> <password>${{secrets.RELEASE_TOKEN}}</password> </server> </servers> <profiles> <profile> <id>ossrh</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <gpg.executable>gpg2</gpg.executable> <gpg.passphrase>${{secrets.gpg_secret}}</gpg.passphrase> </properties> </profile> <profile> <id>allow-snapshots</id> <activation><activeByDefault>true</activeByDefault></activation> <repositories> <repository> <id>snapshots-repo</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>releases-repo</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> </profile> <profile> <id>sonar</id> <properties> <sonar.sources>.</sonar.sources> <sonar.host.url>https://sonarcloud.io</sonar.host.url> </properties> <activation> <activeByDefault>false</activeByDefault> </activation> </profile> </profiles> </settings>" > $GITHUB_WORKSPACE/settings.xml | ||
|
||
- name: Build with Maven | ||
run: | | ||
cd ./${{ env.NFIQ_SERVICE_LOCATION }} | ||
mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml | ||
- name: Publish the maven package | ||
run: | | ||
cd ./${{ env.NFIQ_SERVICE_LOCATION }} | ||
mvn deploy -DskipTests -DaltDeploymentRepository=ossrh::default::${{ secrets.OSSRH_SNAPSHOT_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
GPG_TTY: $(tty) | ||
|