Skip to content

Commit

Permalink
ED-4000 feat: Github actions instead of Jenkins-test-sonar-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
princegupta1131 committed Jun 13, 2024
1 parent ae128cf commit 27b821f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Build
on:
push:
branches:
- "*" # Trigger on push to any branch
- "deploy" # Trigger on push to any branch
pull_request:
branches:
- "*" # Trigger on pull request to any branch
- "deploy" # Trigger on pull request to any branch
workflow_dispatch: # Manual trigger
pull_request_target: # This is to access secrets from forked PRs

Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/build-upload-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Build and Upload Artifact
on:
push:
branches:
- "deploy" # Trigger on push to any branch
- "*" # Trigger on push to the "deploy" branch
pull_request:
branches:
- "deploy" # Trigger on pull request to any branch
- "*" # Trigger on pull request to the "deploy" branch

jobs:
build_and_deploy:
Expand All @@ -32,14 +32,29 @@ jobs:
WL_Customization: ${{ github.event.inputs.WL_Customization }} # Set environment variable WL_Customization

- name: Build and Create Docker Image
id: build_docker_image
run: |
commit_hash=$(git rev-parse --short HEAD) # Get commit hash
build_tag=$(echo "${{ github.ref }}" | rev | cut -d/ -f1 | rev)_${commit_hash}_${GITHUB_RUN_NUMBER} # Generate build tag
echo "build_tag: $build_tag" # Print build tag
echo "build_tag=$build_tag" >> $GITHUB_ENV # Save build tag to environment variable
bash ./build.sh "${build_tag}" "${{ env.NODE_NAME }}" "test" true false "" # Run build script with parameters
env:
NODE_NAME: "18.20.2" # Set environment variable NODE_NAME

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile # Path to your Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }}

- name: Archive Artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Use data
name: Sonar

on:
workflow_run:
Expand Down

0 comments on commit 27b821f

Please sign in to comment.