Lerri-Cofannos is executing app-cd on push at 152af4d1650d7781239f35cfcbf3525e123fe54e #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: app-cd | |
run-name: ${{ github.actor }} is executing ${{ github.workflow }} on ${{ github.event_name }} at ${{ github.sha }} | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
# run on merge since you cannot push to main directly | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- front/** | |
defaults: | |
run: | |
working-directory: front | |
jobs: | |
app-cd: | |
runs-on: ubuntu-latest | |
steps: | |
# Followed https://github.com/aws-actions/configure-aws-credentials | |
# Set up GitHub OIDC using https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-region: eu-west-2 | |
role-to-assume: arn:aws:iam::111982095069:role/github-omnilog | |
role-session-name: GitHubActions-App-CD | |
- name: Checkout main | |
uses: actions/checkout@v3 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Create env file | |
run: | | |
pwd | |
echo "${{ secrets.FRONT_ENV_PRODUCTION }}" > .env.production | |
echo "${{ secrets.FRONT_ENV_PRODUCTION }}" > .env | |
- name: Deploy | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: --cwd front deploy --githubactions # yarn deploy --githubactions | |
- name: Notify slack if any of the previous steps have failed | |
if: ${{ failure() }} | |
uses: slackapi/[email protected] | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
with: | |
payload: | | |
{ | |
"message": "CD has failed", | |
"runUrl": "https://github.com/Theodo-UK/OmniLog/actions/runs/${{ github.run_id }}" | |
} |