Skip to content

Commit

Permalink
Adding files to support Architect deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
thepercyj committed May 14, 2024
1 parent 9926098 commit 10f79e2
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Architect main Branch Deployment

on:
push:
branches:
- main

env:
ARCHITECT_GENERATED: true
ARCHITECT_BRANCH: true
COMPONENT_FILE_PATH: architect.yml
ARCHITECT_ACCOUNT: thepercyj
COMPONENT_NAME: esrs-group-9
ENVIRONMENT_NAME: example-environment
BRANCH_NAME: main
CLUSTER_NAME: architect

jobs:
architect_create_branch_deployments:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH_NAME }}
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: crazy-max/ghaction-github-runtime@v2 # Exports internal envs for Github Actions. Required for register caching to work.
- name: Install Architect CLI
run: npm install -g @architect-io/cli
- name: Login to Architect Cloud
run: architect login -e ${{ secrets.ARCHITECT_EMAIL }} -p ${{ secrets.ARCHITECT_PASSWORD }} # These secrets were created on your behalf
- name: Register component w/ Architect
run: architect register ${{ env.COMPONENT_FILE_PATH }} -t latest
- name: An environment created automatically by a GitHub branch workflow to facilitate automated component deployments
run: architect environment:create --cluster=${{ env.CLUSTER_NAME }} --description="Architect workflow environment" ${{ env.ENVIRONMENT_NAME }}
- name: Deploy component
run: architect deploy --auto-approve -e ${{ env.ENVIRONMENT_NAME }} ${{ env.COMPONENT_NAME }}:latest
55 changes: 55 additions & 0 deletions .github/workflows/thepercyj-esrs-group-9-preview-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Architect Preview Deployment

on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed

env:
ARCHITECT_GENERATED: true
ARCHITECT_PREVIEW: true
PREVIEW_PREFIX: preview-
PREVIEW_TAG: preview-${{ github.event.number }}
PREVIEW_MAINLINE_BRANCH: main
COMPONENT_FILE_PATH: architect.yml
ARCHITECT_ACCOUNT: thepercyj
CLUSTER_NAME: esrs
ENVIRONMENT_TTL:

jobs:
architect_remove_preview:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Architect CLI
run: npm install -g @architect-io/cli
- name: Login to Architect Cloud
run: architect login -e ${{ secrets.ARCHITECT_EMAIL }} -p ${{ secrets.ARCHITECT_PASSWORD }}
- name: Remove components from preview environment
run: architect destroy -e ${{ env.PREVIEW_TAG }} --auto-approve
- name: Remove preview environment
run: architect environment:destroy ${{ env.PREVIEW_TAG }} --auto-approve
architect_create_preview:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: crazy-max/ghaction-github-runtime@v2 # Exports internal envs for Github Actions. Required for register caching to work.
- name: Install Architect CLI
run: npm install -g @architect-io/cli
- name: Login to Architect Cloud
run: architect login -e ${{ secrets.ARCHITECT_EMAIL }} -p ${{ secrets.ARCHITECT_PASSWORD }} # These secrets were created on your behalf
- name: Create env if not exists
run: architect environment:create ${{ env.PREVIEW_TAG }} --cluster ${{ env.CLUSTER_NAME }} ${{ env.ENVIRONMENT_TTL }}
- name: Register and deploy component
run: architect deploy --auto-approve -e ${{ env.PREVIEW_TAG }} ${{ env.COMPONENT_FILE_PATH }}
32 changes: 32 additions & 0 deletions .github/workflows/thepercyj-esrs-group-9-release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Architect Production Deployment

on:
release:
types:
- published

env:
ARCHITECT_GENERATED: true
ARCHITECT_PRODUCTION: true
COMPONENT_FILE_PATH: architect.yml
ARCHITECT_ACCOUNT: thepercyj
COMPONENT_NAME: esrs-group-9
ENVIRONMENT_NAME: example-environment

jobs:
architect_create_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: crazy-max/ghaction-github-runtime@v2 # Exports internal envs for Github Actions. Required for register caching to work.
- name: Install Architect CLI
run: npm install -g @architect-io/cli
- name: Login to Architect Cloud
run: architect login -e ${{ secrets.ARCHITECT_EMAIL }} -p ${{ secrets.ARCHITECT_PASSWORD }} # These secrets were created on your behalf
- name: Register component w/ Architect
run: architect register ${{ env.COMPONENT_FILE_PATH }} -t latest
- name: Deploy component
run: architect deploy --auto-approve -e ${{ env.ENVIRONMENT_NAME }} ${{ env.COMPONENT_NAME }}:latest
15 changes: 15 additions & 0 deletions architect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: esrs-group-9
services:
web:
build:
context: .
dockerfile: Dockerfile
interfaces:
main:
port: 8000
debug:
volumes:
volume:
host_path: .
mount_path: /usr/src/app
reserved_name: web

0 comments on commit 10f79e2

Please sign in to comment.