Skip to content

Päivitä README.md #177

Päivitä README.md

Päivitä README.md #177

name: Test and deploy master
on:
push:
branches:
- master
jobs:
test_and_deploy_dev:
name: Deploy to dev
environment:
name: dev
env:
ENV_NAME: dev
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Java 8
uses: actions/setup-java@v4
with:
java-version: '8'
architecture: 'x64'
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v4
if: steps.check-image.image-exists != '0'
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache Node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Assume role for target environment
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-to-assume: ${{ secrets.DEPLOYMENT_ROLE }}
role-duration-seconds: 3600
role-session-name: LokiDeployment-${{ github.event.inputs.commithash }}
- name: Deploy backend
run: |
cd parser
make deploy env=$ENV_NAME
- name: Deploy frontend
run: |
cd frontend
./deploy.sh $ENV_NAME
test_and_deploy_qa:
name: Deploy to qa
environment:
name: qa
needs: [test_and_deploy_dev]
env:
ENV_NAME: qa
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Java 8
uses: actions/setup-java@v4
with:
java-version: '8'
architecture: 'x64'
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v4
if: steps.check-image.image-exists != '0'
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache Node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Assume role for target environment
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-to-assume: ${{ secrets.DEPLOYMENT_ROLE }}
role-duration-seconds: 3600
role-session-name: LokiDeployment-${{ github.event.inputs.commithash }}
- name: Deploy backend
run: |
cd parser
make deploy env=$ENV_NAME
- name: Deploy frontend
run: |
cd frontend
./deploy.sh $ENV_NAME
test_and_deploy_prod:
name: Deploy to prod
environment:
name: prod
needs: [test_and_deploy_qa]
env:
ENV_NAME: prod
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Java 8
uses: actions/setup-java@v4
with:
java-version: '8'
architecture: 'x64'
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v4
if: steps.check-image.image-exists != '0'
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache Node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Assume role for target environment
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-to-assume: ${{ secrets.DEPLOYMENT_ROLE }}
role-duration-seconds: 3600
role-session-name: LokiDeployment-${{ github.event.inputs.commithash }}
- name: Deploy backend
run: |
cd parser
make deploy env=$ENV_NAME
- name: Deploy frontend
run: |
cd frontend
./deploy.sh $ENV_NAME