generated from xgeekshq/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHORE]: development workflows. local and dev docker files (#593)
* chore(workflows): git flows * chore(dev): add development and local environment * chore(dev): remove unnecessary files * chore: remove package vulnerabilities * refactor(ci): made some changes on pr workflow * chore: fix typo * feat(ci): added workflows to build and deploy * feat(ci): added update changelog workflow Co-authored-by: Rui Silva <r.silva@kigroup.de>
- Loading branch information
1 parent
a0488a5
commit ee8bb21
Showing
19 changed files
with
531 additions
and
164 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This release drafter follows the conventions | ||
# from https://keepachangelog.com | ||
|
||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
template: | | ||
## What Changed 👀 | ||
$CHANGES | ||
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION | ||
categories: | ||
- title: 🚀 Features | ||
labels: | ||
- feature | ||
- enhancement | ||
- title: 🐛 Bug Fixes | ||
labels: | ||
- fix | ||
- bug | ||
- title: ⚠️ Changes | ||
labels: | ||
- changed | ||
- title: ⛔️ Deprecated | ||
labels: | ||
- deprecated | ||
- title: 🗑 Removed | ||
labels: | ||
- removed | ||
- title: 🔐 Security | ||
labels: | ||
- security | ||
- title: 📄 Documentation | ||
labels: | ||
- docs | ||
- documentation | ||
- title: 🧩 Dependency Updates | ||
labels: | ||
- deps | ||
- dependencies | ||
collapse-after: 5 | ||
|
||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
version-resolver: | ||
major: | ||
labels: | ||
- major | ||
minor: | ||
labels: | ||
- minor | ||
patch: | ||
labels: | ||
- patch | ||
default: patch | ||
|
||
exclude-labels: | ||
- skip-changelog |
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,68 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
DOCKERFILE: | ||
required: true | ||
type: string | ||
REPOSITORY: | ||
required: true | ||
type: string | ||
BUILD_ARGS: | ||
required: false | ||
type: string | ||
default: '' | ||
|
||
env: | ||
REGISTRY: split.azurecr.io | ||
TAG: ${{ github.sha }} | ||
|
||
jobs: | ||
build_docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Context for Buildx | ||
run: | | ||
docker context create builders | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
endpoint: builders | ||
|
||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.REGISTRY }} | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Setup Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ inputs.REPOSITORY }} | ||
tags: | | ||
type=raw,value=${{ env.TAG }} | ||
type=raw,value=cache | ||
- name: Build and Push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ${{ inputs.DOCKERFILE }} | ||
push: true | ||
target: production | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: | | ||
type=registry,ref=${{ env.REGISTRY }}/${{ inputs.REPOSITORY }}:${{ env.TAG }} | ||
type=registry,ref=${{ env.REGISTRY }}/${{ inputs.REPOSITORY }}:cache | ||
cache-to: type=inline | ||
build-args: ${{ inputs.BUILD_ARGS }} |
This file was deleted.
Oops, something went wrong.
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,114 @@ | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_backend: | ||
name: Build backend | ||
uses: ./.github/workflows/build_docker.yaml | ||
with: | ||
DOCKERFILE: ./backend/docker/prod/Dockerfile | ||
REPOSITORY: backend | ||
|
||
build_frontend: | ||
name: Build frontend | ||
uses: ./.github/workflows/build_docker.yaml | ||
with: | ||
DOCKERFILE: ./frontend/docker/prod/Dockerfile | ||
REPOSITORY: frontend | ||
BUILD_ARGS: | | ||
NEXT_PUBLIC_BACKEND_URL=${{secrets.NEXT_PUBLIC_BACKEND_URL}} | ||
NEXT_PUBLIC_NEXTAUTH_URL=${{secrets.NEXT_PUBLIC_NEXTAUTH_URL}} | ||
NEXT_PUBLIC_EXPIRATION_TIME=${{secrets.NEXT_PUBLIC_EXPIRATION_TIME}} | ||
NEXT_PUBLIC_ENABLE_AZURE=${{secrets.NEXT_PUBLIC_ENABLE_AZURE}} | ||
deploy_backend_dev: | ||
name: Deploy backend DEV | ||
needs: build_backend | ||
uses: ./.github/workflows/on_call_deploy.yaml | ||
with: | ||
ENVIRONMENT: dev | ||
APP_NAME: split-be-dev | ||
PUBLISH_PROFILE: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }} | ||
REPOSITORY: backend | ||
|
||
deploy_frontend_dev: | ||
name: Deploy frontend DEV | ||
needs: build_frontend | ||
uses: ./.github/workflows/on_call_deploy.yaml | ||
with: | ||
ENVIRONMENT: dev | ||
APP_NAME: split-fe-dev | ||
PUBLISH_PROFILE: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }} | ||
REPOSITORY: frontend | ||
|
||
deploy_backend_prod: | ||
name: Deploy backend PROD | ||
needs: deploy_backend_dev | ||
uses: ./.github/workflows/on_call_deploy.yaml | ||
with: | ||
ENVIRONMENT: prod | ||
APP_NAME: split-be | ||
PUBLISH_PROFILE: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }} | ||
REPOSITORY: backend | ||
|
||
deploy_frontend_prod: | ||
name: Deploy frontend PROD | ||
needs: deploy_frontend_dev | ||
uses: ./.github/workflows/on_call_deploy.yaml | ||
with: | ||
ENVIRONMENT: prod | ||
APP_NAME: split-fe | ||
PUBLISH_PROFILE: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }} | ||
REPOSITORY: frontend | ||
|
||
update_release_draft: | ||
name: Release Drafter | ||
runs-on: ubuntu-latest | ||
needs: | ||
- deploy_backend_dev | ||
- deploy_frontend_dev | ||
steps: | ||
- name: Update release draft | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
pre_release: | ||
name: Create Pre Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: | ||
- deploy_backend_dev | ||
- deploy_frontend_dev | ||
steps: | ||
- name: Update release draft | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
prerelease: true | ||
|
||
release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: | ||
- deploy_backend_prod | ||
- deploy_frontend_prod | ||
steps: | ||
- name: Update release draft | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
publish: true |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
name: Deploy | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ENVIRONMENT: | ||
required: true | ||
type: string | ||
APP_NAME: | ||
required: true | ||
type: string | ||
PUBLISH_PROFILE: | ||
required: true | ||
type: string | ||
REPOSITORY: | ||
required: true | ||
type: string | ||
|
||
env: | ||
TAG: ${{ github.sha }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.ENVIRONMENT }} | ||
steps: | ||
- uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: ${{ inputs.APP_NAME }} | ||
publish-profile: ${{ inputs.PUBLISH_PROFILE }} | ||
images: split.azurecr.io/${{ inputs.REPOSITORY }}:${{ env.TAG }} |
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,28 @@ | ||
name: Update Changelog | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
update: | ||
name: Update Changelog | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
release-notes: ${{ github.event.release.body }} | ||
latest-version: ${{ github.event.release.name }} | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: main | ||
commit_message: 'ci: update version to ${{ github.event.release.name }} [skip ci]' | ||
push_options: --force |
Oops, something went wrong.