forked from Sunbird-Obsrv/obsrv-api-service
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update github actions Signed-off-by: SurabhiAngadi <[email protected]> * remove check-tag action Signed-off-by: SurabhiAngadi <[email protected]> * refactor workflow Signed-off-by: SurabhiAngadi <[email protected]> --------- Signed-off-by: SurabhiAngadi <[email protected]>
- Loading branch information
1 parent
5be2f0d
commit 518d6b2
Showing
4 changed files
with
53 additions
and
33 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 |
---|---|---|
@@ -1,71 +1,66 @@ | ||
name: Obsrv api service build and deploy workflow | ||
name: Build and Deploy | ||
run-name: Workflow run for ${{ github.ref }} | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
- "*" | ||
workflow_dispatch: | ||
inputs: | ||
aws-deploy: | ||
type: boolean | ||
required: true | ||
default: false | ||
jobs: | ||
check-tag: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ALLOWED_TAG: ${{ steps.tag-checker.outputs.TRIGGER_ALLOWED }} | ||
steps: | ||
- name: Check if tag is one in list of current releases | ||
id: tag-checker | ||
run: | | ||
(echo -n TRIGGER_ALLOWED= && echo 'print("${{ github.ref_name }}".split("_")[0] not in "${{ vars.CURRENT_RELEASE }}")' | python3) >> "$GITHUB_OUTPUT" | ||
docker-build-api-service: | ||
needs: check-tag | ||
if: needs.check-tag.outputs.ALLOWED_TAG == 'True' | ||
build-api-service-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to docker hub | ||
uses: docker/login-action@v2 | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build docker image and push | ||
uses: docker/build-push-action@v4 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./api-service/Dockerfile | ||
push: true | ||
tags: ${{ vars.DOCKERHUB_USERNAME }}/obsrv-api-service:${{ github.ref_name }} | ||
|
||
docker-build-command-service: | ||
needs: check-tag | ||
if: needs.check-tag.outputs.ALLOWED_TAG == 'True' | ||
build-command-service-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to docker hub | ||
uses: docker/login-action@v1 | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Build docker image and push | ||
uses: docker/build-push-action@v2 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./command-service/Dockerfile | ||
context: ./command-service | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ vars.DOCKERHUB_USERNAME }}/flink-command-service:${{ github.ref_name }} | ||
|
||
aws-deploy: | ||
needs: [check-tag, docker-build-api-service, docker-build-command-service] | ||
if: needs.check-tag.outputs.ALLOWED_TAG == 'True' | ||
needs: [build-api-service-image, build-command-service-image] | ||
if: github.event.inputs.aws-deploy == 'true' | ||
runs-on: ubuntu-latest | ||
environment: aws-dev | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
- name: Setup Terragrunt | ||
uses: autero1/[email protected] | ||
with: | ||
terragrunt_version: v0.45.8 | ||
- name: Terragrunt installation | ||
run: terragrunt --version | ||
- name: Clone the terraform deployment repo | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ vars.DEPLOY_REPO }} | ||
path: deploy | ||
|
@@ -97,12 +92,12 @@ jobs: | |
-var dataset_api_image_tag=${{ github.ref_name }} | ||
azure-deploy: | ||
needs: [check-tag, docker-build-api-service, docker-build-command-service] | ||
if: needs.check-tag.outputs.ALLOWED_TAG == 'True' && vars.CLOUD_PROVIDER == 'azure' | ||
needs: [build-api-service-image, build-command-service-image] | ||
if: vars.CLOUD_PROVIDER == 'azure' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone the terraform deployment repo | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ vars.DEPLOY_REPO }} | ||
path: deploy | ||
|
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,26 @@ | ||
name: Pull Request | ||
run-name: Workflow run for pull request- ${{ github.event.pull_request.title }} | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
test-cases: | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.10' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run test cases | ||
run: | | ||
cd api-service | ||
npm install | ||
npm run actions:test |
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
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