diff --git a/.github/workflows/cicd-try1.yml b/.github/workflows/cicd-try1.yml new file mode 100644 index 0000000..28c8fcb --- /dev/null +++ b/.github/workflows/cicd-try1.yml @@ -0,0 +1,20 @@ +name: CI/CD Try1 +on: push + +jobs: + deploy-dev: + uses: ./.github/workflows/deploy.yml + with: + environment: dev + + deploy-staging: + needs: deploy-dev + uses: ./.github/workflows/deploy.yml + with: + environment: staging + + deploy-prod: + needs: deploy-staging + uses: ./.github/workflows/deploy.yml + with: + environment: prod diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c0b409d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,17 @@ +name: Deploy + +on: + workflow_call: + inputs: + environment: + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Terraform try + run: echo "Deploying ${{ inputs.environment }}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90a3780..2dbec05 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,27 @@ -name: CI +name: CICD on: push jobs: - test: + dev: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install - run: npm test + staging: + runs-on: ubuntu-latest + needs: dev + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - run: npm install + - run: npm test + prod: + runs-on: ubuntu-latest + needs: staging + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - run: npm install + - run: npm test