Skip to content

Commit

Permalink
Add autodeploy for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
giade committed Nov 17, 2023
1 parent bd47cf3 commit 93b3c5f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy Frontend Production

on:
push:
branches: [ master ]

jobs:
deploy-production:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'

steps:
- uses: actions/checkout@v2

- name: Cache modules
uses: actions/cache@v1
id: yarn-cache
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install Yarn
run: npm install -g yarn

- name: Run a multi-line script
run: |
yarn
yarn build
- name: Deploy
id: deploy
continue-on-error: true
run: aws s3 sync ./www s3://${{ secrets.AWS_BUCKET_FRONT_PROD }}/giada --delete --acl public-read

# - name: Notify Failure
# if: steps.deploy.outcome != 'success'
# uses: voxmedia/github-action-slack-notify-build@v1
# env:
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
# with:
# message_id: ${{ steps.slack.outputs.message_id }}
# channel_id: C049RNZ524T
# status: FAILED
# color: danger

# - name: Notify Success
# if: steps.deploy.outcome == 'success'
# uses: voxmedia/github-action-slack-notify-build@v1
# env:
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
# with:
# message_id: ${{ steps.slack.outputs.message_id }}
# channel_id: C049RNZ524T
# status: SUCCESS
# color: good
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Frontend
name: Deploy Frontend Staging

on:
push:
Expand Down

0 comments on commit 93b3c5f

Please sign in to comment.