diff --git a/.github/workflows/master_mywebappdar.yml b/.github/workflows/master_mywebappdar.yml new file mode 100644 index 0000000..29115ed --- /dev/null +++ b/.github/workflows/master_mywebappdar.yml @@ -0,0 +1,56 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy Node.js app to Azure Web App - mywebappdar + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: '18.x' + + - name: npm install, build, and test + run: | + npm install + npm run build + npm run test + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: node-app + path: . + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: node-app + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v2 + id: deploy-to-webapp + with: + app-name: 'mywebappdar' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_60DA1E8724F7436BB0407FBA8C825669 }} + package: . diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 82af4a9..9875031 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -28,9 +28,9 @@ jobs: - name: Build & push Docker image uses: mr-smithers-excellent/docker-build-push@v5 with: - image: javatechie/springboot-images-new + image: mydockersureshvelpula/javaspring-app-github-actions tags: latest registry: docker.io dockerfile: Dockerfile username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file + password: ${{ secrets.DOCKER_PASSWORD }} diff --git a/Dockerfile b/Dockerfile index f7cd959..6c20c4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM openjdk:8 -EXPOSE 8080 +EXPOSE 8081 ADD target/springboot-images-new.jar springboot-images-new.jar -ENTRYPOINT ["java","-jar","/springboot-images-new.jar"] \ No newline at end of file +ENTRYPOINT ["java","-jar","/springboot-images-new.jar"] diff --git a/src/main/java/com/javatechie/cicd/GithubCicdActionsApplication.java b/src/main/java/com/javatechie/cicd/GithubCicdActionsApplication.java index 71e908b..d7ec443 100644 --- a/src/main/java/com/javatechie/cicd/GithubCicdActionsApplication.java +++ b/src/main/java/com/javatechie/cicd/GithubCicdActionsApplication.java @@ -11,7 +11,7 @@ public class GithubCicdActionsApplication { @GetMapping("/welcome") public String welcome(){ - return "Welcome to javatechie !"; + return "Welcome Suresh !"; } // echo "# github-actions-example" >> README.md