[chore] deploy automatically #25
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
name: Oss Service Integration Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: it | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
java: [ '17','21' ] | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
env: | |
SERVER_PORT_NO: 8081 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B -P+it package -Djava.version=${{ matrix.java }} --file pom.xml | |
- name: Run AllInOne Application | |
uses: JarvusInnovations/[email protected] | |
with: | |
working-directory: oss-server | |
wait-for: 2m | |
tail: true | |
run: java -jar target/oss-server-fat.jar --spring.profiles.active=oss-dev & | |
wait-on: http-get://localhost:${{ env.SERVER_PORT_NO }}/actuator/health | |
- name: Download ijhttp tools | |
run: |- | |
curl -f -L -o ijhttp.zip "https://jb.gg/ijhttp/latest" | |
unzip ijhttp.zip | |
./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 |