env #1
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
name: Deployment | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
env: | |
MONGODB_DB_NAME: gha-demo | |
PORT: 4000 | |
jobs: | |
test: | |
environment: testing | |
runs-on: ubuntu-latest | |
env: | |
MONGODB_PASSWORD: fdgfdjhdfjgjg | |
MONGODB_CLUSTER_ADDRESS: fsjdigj | |
MONGODB_USERNAME: sa | |
steps: | |
- name: Get Code | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: npm-deps-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Run server | |
run: npm start & npx wait-on http://127.0.0.1:$PORT | |
- name: Run tests | |
run: npm test | |
- name: Output information | |
run: echo "MONGODB Username ${{env.MONGODB_USERNAME}}" | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Output information | |
run: | | |
run: echo "MONGODB Username ${{env.MONGODB_USERNAME}}" | |
run: echo "MONGODB Database ${{env.MONGODB_DB_NAME}}" |