From 4b55fb84f21c1b868b2e05292dce6b63dbc4021a Mon Sep 17 00:00:00 2001 From: Prasanna S R Date: Fri, 15 Sep 2023 11:17:25 +0530 Subject: [PATCH 1/2] Create manual.yml --- .github/workflows/manual.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/manual.yml diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 000000000..622732319 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,27 @@ +# This is a basic workflow that is manually triggered + +name: Build and Publish + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + version: + description: 'Enter the version number of the build to be generated' + required: true + type: string + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "greet" + greet: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Runs a single command using the runners shell + - name: Send greeting + run: echo "Hello ${{ inputs.name }}" From 6a881ad3d0a3fb7c5a810596917312eacd200556 Mon Sep 17 00:00:00 2001 From: Prasanna S R Date: Wed, 20 Sep 2023 10:13:07 +0530 Subject: [PATCH 2/2] Adding Github Actions --- .github/workflows/manual.yml | 61 ++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index 622732319..43efc99c3 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -13,15 +13,70 @@ on: required: true type: string +env: + DOCKER_REGISTRY: ghcr.io + DOCKER_NAMESPACE: sunbird-rc + REGISTRY_IMAGE_NAME: sunbird-rc-core + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "greet" - greet: + release: + name: Build Docker Images and Push to Github Container Registry # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: # Runs a single command using the runners shell - - name: Send greeting - run: echo "Hello ${{ inputs.name }}" + - name: Checkout Code + uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'maven' + - name: Setup Golang + uses: actions/setup-go@v3 + with: + go-version: 1.19 + - name: Setup NodeJS + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Log in to GHCR Docker Registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Configure Dependencies + uses: actions/github-script@v6 + with: + script: | + sh configure-dependencies.sh; + cd java && ./mvnw clean install; + rm -rf java/claim/target/*.jar; + cd target; + rm -rf *; + jar xvf ../java/registry/target/registry.jar; + cp ../java/Dockerfile ./; + - name: Extract metadata (tags, labels) for Sunbird-RC Core + id: registry-meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${{ env.REGISTRY_IMAGE_NAME }} + tags: | + type=raw,value=latest + type=raw,value=${{ inputs.version }} + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: target/Dockerfile + push: true + tags: ${{ steps.registry-meta.outputs.tags }} + labels: ${{ steps.registry-meta.outputs.labels }} + + +