mirror of
https://github.com/privacy-scaling-explorations/pse.dev.git
synced 2026-01-10 22:58:06 -05:00
Add deploy workflow + aux scritps
This commit is contained in:
13
.github/scripts/build.sh
vendored
Executable file
13
.github/scripts/build.sh
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
build=$1
|
||||
|
||||
[ $build = "enable" ] || exit 0
|
||||
|
||||
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 490752553772.dkr.ecr.eu-central-1.amazonaws.com
|
||||
|
||||
docker build -t pse-web .
|
||||
docker tag pse-web:latest 490752553772.dkr.ecr.eu-central-1.amazonaws.com/pse-web:latest
|
||||
docker push 490752553772.dkr.ecr.eu-central-1.amazonaws.com/pse-web:latest
|
||||
|
||||
exit 0
|
||||
10
.github/scripts/deploy.sh
vendored
Executable file
10
.github/scripts/deploy.sh
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
tasks="pse-web"
|
||||
for task in $tasks; do
|
||||
pse-web_revision=$(aws ecs describe-task-definition --task-definition $task --query "taskDefinition.revision")
|
||||
aws ecs update-service --cluster pse-web --service $task --force-new-deployment --task-definition $task:$pse-web_revision
|
||||
done
|
||||
|
||||
aws ecs wait services-stable --cluster pse-web --services $tasks
|
||||
48
.github/workflows/deploy.yml
vendored
Normal file
48
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Deploy
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build:
|
||||
description: "Build trigger"
|
||||
required: true
|
||||
default: "enable"
|
||||
type: choice
|
||||
options:
|
||||
- enable
|
||||
- disable
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DATA: ${{ github.event.inputs.build }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::490752553772:role/pse-web-ecs-deploy-slc
|
||||
role-duration-seconds: 1800
|
||||
aws-region: eu-central-1
|
||||
|
||||
- name: Build and Push images to ECR
|
||||
run: |
|
||||
.github/scripts/build.sh ${{ env.DATA }}
|
||||
|
||||
- name: Create Deployment
|
||||
run: |
|
||||
.github/scripts/deploy.sh
|
||||
Reference in New Issue
Block a user