Skip to content

Commit

Permalink
chore(devops): deploy when push to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarseguerra committed May 16, 2024
1 parent 4890345 commit 508b3be
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 98 deletions.
26 changes: 5 additions & 21 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,13 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
node-version: 20.x
cache: npm
- run: npm ci
- name: Lint
run: npm run lint

# ===== Test
- run: npm run lint
- run: npm test
- run: npm run-script coverage
- name: Coveralls GitHub Action
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Deploy to api.grottocenter.org - Azure Web App

on:
push:
branches:
- develop
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm

- name: npm install
run: npm ci

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: Production
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: grottocenter-api
slot-name: Production
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_5DD3F98CDE1C435DB2207514EBB10150 }}
package: .
72 changes: 0 additions & 72 deletions .github/workflows/master_grottocenter-api.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ If the build is triggered from a push on `master` then a deployment of the API t

### Deployment in production

Deployment done with GitHub Actions and Azure App Service.
Deployment is done with GitHub Actions on Azure App Service when a pull request is merged into the `develop` branch.

You first need to merge your changes to `master` using if possible the `git flow release start vXX.X.X` command.
#### API release

Don't forget to update the version number on the `swagger` file and on the `package.json` file.
Additionally, periodic release of the API can be done.

when the merge on master is completed, you should create a release for the newly pushed tag.
You first need to merge your changes to `master` using if possible the `git flow release start vXX.X.X` command. Don't forget to update the version number on the `swagger` file and on the `package.json` file. When the merge on master is completed, you should create a release for the newly pushed tag.

For more information see the wiki page [Production deployment](https://github.com/GrottoCenter/Grottocenter3/wiki/Production-deployment)

Expand All @@ -168,7 +168,7 @@ When running the `git flow init` command you should keep all the default configu

You should use the proper type when creating a new branch with the workflow (`feature`, `bugfix`, `hotfix`, ...).

Before pushing your branch always de a `git rebase -i` to merge unnecessary commits together.
Before pushing your branch always do a `git rebase -i` to merge unnecessary commits together.

#### Merging

Expand Down

0 comments on commit 508b3be

Please sign in to comment.