Skip to content

Commit

Permalink
fix:merge with the main
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdizahedii2005 committed Sep 9, 2024
2 parents 3fdab19 + 130f409 commit e02c384
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 79 deletions.
208 changes: 131 additions & 77 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,83 +1,137 @@
name: Bump version, build and release
on:
push:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
tag:
name: Tag and release
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
new_version: ${{ steps.tag_version.outputs.new_version }}
changelog: ${{ steps.tag_version.outputs.changelog }}

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch

- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}

build:
name: Build and push
runs-on: ubuntu-latest
needs: tag

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Metadata extraction
id: metadata
uses: docker/metadata-action@v5
with:
# List of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# Generates Docker tags based on the following events/attributes
tags: |
type=raw,value=${{ needs.tag.outputs.new_tag }}
type=raw,value=${{ needs.tag.outputs.new_version }}
type=sha
latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
context: "{{defaultContext}}:mohaymen-codestar-Team02"
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
tag:
name: Tag and release
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
new_version: ${{ steps.tag_version.outputs.new_version }}
changelog: ${{ steps.tag_version.outputs.changelog }}

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch

- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}

build:
name: Build and push
runs-on: ubuntu-latest
needs: tag

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Metadata extraction
id: metadata
uses: docker/metadata-action@v5
with:
# List of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# Generates Docker tags based on the following events/attributes
tags: |
type=raw,value=${{ needs.tag.outputs.new_tag }}
type=raw,value=${{ needs.tag.outputs.new_version }}
type=sha
latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
context: "{{defaultContext}}:mohaymen-codestar-Team02"
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

deployment:
name: Update deployment
runs-on: ubuntu-latest
needs: [build, tag]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-deployment
cancel-in-progress: true

steps:
- name: Check if deployment PAT is set
id: deployment_check
run: |
if [ -z "${{ secrets.DEPLOYMENT_PAT }}" ]; then
echo "DEPLOYMENT_PAT is not set. Skipping deployment."
echo "deployment_enabled=false" >> $GITHUB_OUTPUT
exit 0
else
echo "deployment_enabled=true" >> $GITHUB_OUTPUT
echo "deployment_enabled=true" >> $GITHUB_OUTPUT
fi
- name: Update deployment
uses: actions/github-script@v7
if: steps.deployment_check.outputs.deployment_enabled == 'true'
with:
github-token: ${{ secrets.DEPLOYMENT_PAT }}
script: |
const owner = '${{ secrets.DEPLOYMENT_OWNER }}'
const repo = '${{ secrets.DEPLOYMENT_REPO }}'
const workflow_id = '${{ secrets.DEPLOYMENT_WORKFLOW }}'
const ref = 'main'
const deployment_name = '${{ secrets.DEPLOYMENT_NAME }}'
const version = '${{ needs.tag.outputs.new_version }}'
if (!owner || !repo || !workflow_id || !deployment_name || !version) {
core.setFailed('Missing required inputs')
return
}
// Trigger the workflow dispatch using Octokit API (from github object)
await github.rest.actions.createWorkflowDispatch({
owner: owner,
repo: repo,
workflow_id: workflow_id,
ref: ref,
inputs: {
version: version,
deployment: deployment_name,
}
});
console.log('Workflow dispatch triggered successfully.');
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[![codecov](https://codecov.io/gh/Star-Academy/Summer1403-Project-Group02-Backend/graph/badge.svg?token=RTFUFYQP6S)](https://codecov.io/gh/Star-Academy/Summer1403-Project-Group02-Backend)
# Summer1403-Project-Group02-Backend

4 changes: 2 additions & 2 deletions mohaymen-codestar-Team02/Controllers/AnalystController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ await _analystService.DisplayGeraphData(filterGraphDto.DatasetId, filterGraphDto
}

[HttpGet("Analyst/Vertex/{id}")]
public async Task<IActionResult> DisplayVertexAttributes(long id)
public IActionResult DisplayVertexAttributes(long id)
{
ServiceResponse<List<GetAttributeDto>> response;
try
Expand All @@ -72,7 +72,7 @@ public async Task<IActionResult> DisplayVertexAttributes(long id)
}

[HttpGet("Analyst/Edge/{id}")]
public async Task<IActionResult> DisplayEdgeAttributes(long id)
public IActionResult DisplayEdgeAttributes(long id)
{
ServiceResponse<List<GetAttributeDto>> response;
try
Expand Down

0 comments on commit e02c384

Please sign in to comment.