Files
actions-environment/.gitea/workflows/deploy.yml
T
tom.coursow 38dbe0ff74
Deployment / test (push) Successful in 1m46s
Deployment / lol (push) Successful in 5s
Deployment / deploy (push) Successful in 3s
Update .gitea/workflows/deploy.yml
2023-07-15 03:05:49 +02:00

67 lines
2.1 KiB
YAML

name: Deployment
on:
push:
branches:
- master
- dev
env:
# Global Env Variables readable in all jobs of this workflow
MONGODB_CLUSTER_ADDRESS: coursow-de.bwnpjvo.mongodb.net
MONGODB_USERNAME: ${{secrets.MONGODB_USER}} # Added / configured in Repo Action Settings UI
MONGODB_PASSWORD: ${{secrets.MONGODB_PASSWORD}} # Added / configured in Repo Action Settings UI
MONGODB_DB_NAME: actions-environment
WEB_PORT: 8080
jobs:
test:
env:
ONLY_HERE: ofcourse # Will be only readable in this 'test' job
environment: testing
runs-on: ubuntu-latest
steps:
- name: Get Code
uses: actions/checkout@v3
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: '18'
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- uses: actions/go-hashfiles@v0.0.1
id: get-cache-hash
with:
patterns: |-
**/package-lock.json
- name: Check Chache
uses: https://github.com/actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
- name: Install dependencies
run: npm ci
- name: Run server
run: npm start & npx wait-on http://127.0.0.1:$WEB_PORT
- name: Run tests
run: npm test
- name: Output information
run: echo "$ONLY_HERE" # Works... Will return a value as defined in this job
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- name: Output information
run: |
echo "$ONLY_HERE" # Will not work... As it is not defined in global env or this 'deploy' job env
echo "$MONGODB_USERNAME" # Works... Will return a value as defined in global env
# But will NOT print the real username value as it is a "secret" (will print *****)
lol:
runs-on: ubuntu-latest
steps:
- name: Try output only in same job
id: try
run: echo 'lil=lul' >> $GITHUB_OUTPUT
- name: Try access
run: echo ${{ steps.try.lil }}