Skip to content

Commit

Permalink
[chore] deploy automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ninggf committed Apr 17, 2024
1 parent 463e309 commit e8466cd
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to OSSRH

on:
push:
tags:
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-22.04
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_SECURITY_PWD: ${{ secrets.GPG_SECURITY_PWD }}
steps:
- name: Install gpg secret key
run: |-
# Install gpg secret key
cat <(echo -e "${{ secrets.GPG_SECURITY_KEY }}") | gpg --batch --import
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: maven
- name: Set up maven settings
uses: s4u/[email protected]
with:
servers: |
[{
"id": "ossrh",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}]
- name: Deploy to OSSRH
run: mvn -P+release -Djava.version=17 -DskipTests=true clean deploy
39 changes: 39 additions & 0 deletions .github/workflows/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -51,3 +54,39 @@ jobs:
./ijhttp/ijhttp --version
- name: Execute HTTP requests
run: ./ijhttp/ijhttp oss-server/src/test/http/test.http oss-server/src/test/http/chunked.http
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [ "build" ]
runs-on: ubuntu-22.04
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_SECURITY_PWD: ${{ secrets.GPG_SECURITY_PWD }}
steps:
- name: Install gpg secret key
run: |-
# Install gpg secret key
cat <(echo -e "${{ secrets.GPG_SECURITY_KEY }}") | gpg --batch --import
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: maven
- name: Set up maven settings
uses: s4u/[email protected]
with:
servers: |
[{
"id": "ossrh",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}]
- name: Deploy to OSSRH
run: mvn -P+release -Djava.version=17 -DskipTests=true clean deploy
29 changes: 26 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>apzda-cloud-gsvc-parent</artifactId>
Expand Down Expand Up @@ -145,10 +146,9 @@
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>v@{project.version}</tagNameFormat>
<generateReleasePoms>false</generateReleasePoms>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<arguments>-Dmaven.site.skip=true</arguments>
<goals>deploy</goals>
<goals>clean,compile</goals>
</configuration>
</plugin>
<!-- nexus-staging-maven-plugin -->
Expand All @@ -163,6 +163,29 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- maven-gpg-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
<arg>--no-tty</arg>
</gpgArguments>
<passphraseEnvName>GPG_SECURITY_PWD</passphraseEnvName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down

0 comments on commit e8466cd

Please sign in to comment.