generated from wednesday-solutions/nodejs-hapi-template
-
Notifications
You must be signed in to change notification settings - Fork 29
112 lines (100 loc) · 3.81 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Node Express GraphQL Template CD
on:
push:
branches:
- develop
jobs:
# docker-build-push-deploy:
# name: Docker build, push and deploy
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Get branch name
# id: vars
# run: echo ::set-output name=stage::${GITHUB_REF#refs/*/}
# - name: Set env.ENV_NAME and env.BUILD_NAME
# run: |
# if [[ ${{steps.vars.outputs.stage}} == 'main' ]]; then
# echo "BUILD_NAME=prod" >> "$GITHUB_ENV"
# else
# echo "ENV_NAME=.development" >> "$GITHUB_ENV"
# echo "BUILD_NAME=dev" >> "$GITHUB_ENV"
# fi
# - 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: ${{ secrets.AWS_REGION }}
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
# - name: Build, tag, and push image to Amazon ECR
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }}-${{steps.vars.outputs.stage}}
# AWS_REGION: ${{ secrets.AWS_REGION }}
# IMAGE_TAG: ${{ github.sha }}
# run: |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --build-arg ENVIRONMENT_NAME=${{ env.ENV_NAME }} --build-arg BUILD_NAME=${{ env.BUILD_NAME }}
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# - name: Render Amazon ECS task definition
# id: ecs-cd-starter-container
# uses: aws-actions/amazon-ecs-render-task-definition@v1
# with:
# task-definition: task-definition/${{steps.vars.outputs.stage}}.json #1
# container-name: ecs-cd-starter-${{steps.vars.outputs.stage}} #2
# image: ${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_ECR_REPOSITORY }}-${{steps.vars.outputs.stage}}:${{ github.sha }}
# - name: Deploy to Amazon ECS service
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: ${{ steps.ecs-cd-starter-container.outputs.task-definition }}
# service: ecs-cd-starter-${{ steps.vars.outputs.stage }}
# cluster: ecs-cd-starter-${{ steps.vars.outputs.stage }}
# - name: Logout of Amazon ECR
# if: always()
# run: docker logout ${{ steps.login-ecr.outputs.registry }}
create_badges:
name: Create Badges
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v2
- name: Setup environment
uses: actions/setup-node@v2
with:
cache: 'yarn'
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
- name: Create badges
run: yarn run test:badges
- name: Commit badges
uses: EndBug/add-and-commit@v7
with:
author_name: Gitflow
author_email: [email protected]
message: 'Update badges'
add: 'badges/'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
update_diagram:
name: Update diagram
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: wednesday-solutions/[email protected]
with:
should_push: true
branch: '${{ github.event.pull_request.head.ref }}'
output_file: 'repo-visualizer.svg'
excluded_paths: node_modules,dist,.yarn,.vscode,yarn.lock,coverage,report.json,reports,.github
commit_message: 'Updating diagram [skip ci]'