Skip to content

Build and deploy

Build and deploy #2

name: build-and-deploy
run-name: Build and deploy
on:
push:
branches:
- "develop"
- "main"
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
google-cloud: ${{ steps.filter.outputs.google-cloud }}
aws-eks: ${{ steps.filter.outputs.aws-eks }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
base: 'develop'
filters: |
aws-eks:
- 'backend/**'
- 'frontend/**'
- 'k8s/**'
- 'pulumi/aws-eks/**'
- 'selenium/**'
- 'tests-ui/**'
google-cloud:
- 'pulumi/google-cloud/**'
deploy-taf:
runs-on: ubuntu-latest
needs: check-changes
if: ${{ needs.check-changes.outputs.aws-eks == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: npm
cache-dependency-pack: pulumi/aws-eks/package-lock.json
- run: npm install --prefix pulumi/aws-eks
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ secrets.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- uses: pulumi/actions@v3
with:
command: up
stack-name: mgl805/aws-eks/dev
work-dir: pulumi/aws-eks
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
deploy-wikijs:
runs-on: ubuntu-latest
needs: check-changes
if: ${{ needs.check-changes.outputs.google-cloud == 'true'}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
cache-dependency-path: pulumi/google-cloud/yarn.lock
- run: yarn --cwd pulumi/google-cloud install
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_GITHUB_SA_KEY }}'
- id: pulumi
uses: pulumi/actions@v3
with:
command: up
stack-name: mgl805/google-cloud/dev
work-dir: pulumi/google-cloud
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}