-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9a6df8
commit 6f7bdee
Showing
3 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
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,69 @@ | ||
name: Deploy Develop | ||
on: | ||
push: | ||
branches: ["develop"] | ||
pull_request: | ||
branches: ["develop"] | ||
workflow_dispatch: | ||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Maven | ||
run: sudo apt-get install -y maven | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "temurin" | ||
cache: maven | ||
- name: Build with Maven | ||
env: | ||
DATASOURCE_PASSWORD: ${{ secrets.DATASOURCE_PASSWORD }} | ||
DATASOURCE_URL: ${{ secrets.NEON_DATASOURCE_URL }}/${{ secrets.DB_NAME }} | ||
DATASOURCE_USERNAME: ${{ secrets.DATASOURCE_USERNAME }} | ||
GOOGLE_ADMIN_CONFIG_TYPE: ${{ secrets.GOOGLE_ADMIN_CONFIG_TYPE }} | ||
GOOGLE_ADMIN_CONFIG_PROJECT_ID: ${{ secrets.GOOGLE_ADMIN_CONFIG_PROJECT_ID }} | ||
GOOGLE_ADMIN_CONFIG_PRIVATE_KEY: ${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY }} | ||
GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID: ${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID }} | ||
GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL: ${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL }} | ||
GOOGLE_ADMIN_CONFIG_CLIENT_ID: ${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_ID }} | ||
GOOGLE_ADMIN_CONFIG_CLIENT_X509_CERT_URL: ${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_X509_CERT_URL }} | ||
run: mvn clean install | ||
|
||
deploy: | ||
name: Deploy on Develop | ||
runs-on: self-hosted | ||
needs: Build | ||
steps: | ||
- name: executing remote ssh commands using ssh key | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.DEV_HOST }} | ||
username: ${{ secrets.HOSTS_USERNAME }} | ||
key: ${{ secrets.DEV_SSH_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
cd AllConnected/${{ github.event.repository.name }} | ||
echo "Fetching latest code..." | ||
git fetch | ||
git checkout develop | ||
git pull | ||
echo "Building Docker image..." | ||
docker build -t ${{ github.event.repository.name }} . | ||
echo "Creating .env file..." | ||
echo "DATASOURCE_URL=${{ secrets.DEV_DATASOURCE_URL }}/${{ secrets.DB_NAME }}" >> .env | ||
echo "DATASOURCE_USERNAME=${{ secrets.DATASOURCE_USERNAME }}" >> .env | ||
echo "DATASOURCE_PASSWORD=${{ secrets.DATASOURCE_PASSWORD }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_TYPE=${{ secrets.GOOGLE_ADMIN_CONFIG_TYPE }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_PROJECT_ID=${{ secrets.GOOGLE_ADMIN_CONFIG_PROJECT_ID }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_PRIVATE_KEY=${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID=${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL=${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_CLIENT_ID=${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_ID }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_X509_CERT_URL=${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_X509_CERT_URL }}" >> .env | ||
docker rm -f ${{ github.event.repository.name }} | ||
docker run --name ${{ github.event.repository.name }} --network all_connected -d -p ${{ secrets.SERVICE_PORT }}:8080 --env-file .env ${{ github.event.repository.name }} | ||
echo "Docker container running..." | ||
rm .env |
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,69 @@ | ||
name: Deploy QA | ||
on: | ||
push: | ||
branches: ["release"] | ||
pull_request: | ||
branches: ["release"] | ||
workflow_dispatch: | ||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Maven | ||
run: sudo apt-get install -y maven | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "temurin" | ||
cache: maven | ||
- name: Build with Maven | ||
env: | ||
DATASOURCE_PASSWORD: ${{ secrets.DATASOURCE_PASSWORD }} | ||
DATASOURCE_URL: ${{ secrets.NEON_DATASOURCE_URL }}/${{ secrets.DB_NAME }} | ||
DATASOURCE_USERNAME: ${{ secrets.DATASOURCE_USERNAME }} | ||
GOOGLE_ADMIN_CONFIG_TYPE: ${{ secrets.GOOGLE_ADMIN_CONFIG_TYPE }} | ||
GOOGLE_ADMIN_CONFIG_PROJECT_ID: ${{ secrets.GOOGLE_ADMIN_CONFIG_PROJECT_ID }} | ||
GOOGLE_ADMIN_CONFIG_PRIVATE_KEY: ${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY }} | ||
GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID: ${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID }} | ||
GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL: ${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL }} | ||
GOOGLE_ADMIN_CONFIG_CLIENT_ID: ${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_ID }} | ||
GOOGLE_ADMIN_CONFIG_CLIENT_X509_CERT_URL: ${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_X509_CERT_URL }} | ||
run: mvn clean install | ||
|
||
Deploy: | ||
name: Deploy on QA | ||
runs-on: self-hosted | ||
needs: Build | ||
steps: | ||
- name: executing remote ssh commands using ssh key | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.QA_G2_HOST }} | ||
username: ${{ secrets.HOSTS_USERNAME }} | ||
key: ${{ secrets.QA_G2_SSH_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
cd AllConnected/${{ github.event.repository.name }} | ||
echo "Fetching latest code..." | ||
git fetch | ||
git checkout release | ||
git pull | ||
echo "Building Docker image..." | ||
docker build -t ${{ github.event.repository.name }} . | ||
echo "Creating .env file..." | ||
echo "DATASOURCE_URL=${{ secrets.QA_DATASOURCE_G2_URL }}/${{ secrets.DB_NAME }}" >> .env | ||
echo "DATASOURCE_USERNAME=${{ secrets.DATASOURCE_USERNAME }}" >> .env | ||
echo "DATASOURCE_PASSWORD=${{ secrets.DATASOURCE_PASSWORD }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_TYPE=${{ secrets.GOOGLE_ADMIN_CONFIG_TYPE }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_PROJECT_ID=${{ secrets.GOOGLE_ADMIN_CONFIG_PROJECT_ID }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_PRIVATE_KEY=${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID=${{ secrets.GOOGLE_ADMIN_CONFIG_PRIVATE_KEY_ID }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL=${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_EMAIL }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_CLIENT_ID=${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_ID }}" >> .env | ||
echo "GOOGLE_ADMIN_CONFIG_X509_CERT_URL=${{ secrets.GOOGLE_ADMIN_CONFIG_CLIENT_X509_CERT_URL }}" >> .env | ||
docker rm -f ${{ github.event.repository.name }} | ||
docker run --name ${{ github.event.repository.name }} --network all_connected -d -p ${{ secrets.SERVICE_PORT }}:8080 --env-file .env ${{ github.event.repository.name }} | ||
echo "Docker container running..." | ||
rm .env |
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,24 @@ | ||
# Etapa 1: Build | ||
FROM maven:3.9.4-eclipse-temurin-21 AS build | ||
|
||
WORKDIR /app | ||
|
||
# Copiar el pom y código fuente | ||
COPY pom.xml ./ | ||
RUN mvn dependency:go-offline | ||
|
||
COPY src ./src | ||
|
||
RUN mvn clean package -DskipTests | ||
|
||
# Etapa 2: Run | ||
FROM eclipse-temurin:21-jdk-jammy | ||
|
||
WORKDIR /app | ||
|
||
# Copiar el jar generado desde la etapa de build | ||
COPY --from=build /app/target/*.jar app.jar | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["java", "-jar", "app.jar"] |