From 314c90a58026230e792d7c81138964764c1372d0 Mon Sep 17 00:00:00 2001 From: gregorycottone Cottone Date: Fri, 17 May 2024 09:50:15 +0000 Subject: [PATCH] exercise 4 workflow.yaml creation --- .github/workflows/workflow.yaml | 39 ++++++++++++++++++++++++++++++ exercise_4/workflow copy.yaml | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/workflow.yaml create mode 100644 exercise_4/workflow copy.yaml diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 0000000..c1f4f46 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,39 @@ +name: Protected envs and stages + +on: + push: + branches: + - master + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout github repository + uses: actions/checkout@v4 + + - name: Build or simulate building + run: sleep 5 + + - name: Finish building + run: echo "Build completed successfully" + + deploy: + runs-on: ubuntu-latest + needs: [build-and-push] + strategy: + matrix: + environment: ['dev', 'int'] + environment: ${{ matrix.environment}} + steps: + - name: Checkout github repository + uses: actions/checkout@v4 + + - name: Print environment + run: echo "Deploying to environment ${{ matrix.environment}}" + + - name: Simulate deployment + run: sleep 5 + + - name: Finish deployment + run: echo "Deployment completed successfully" \ No newline at end of file diff --git a/exercise_4/workflow copy.yaml b/exercise_4/workflow copy.yaml new file mode 100644 index 0000000..3e56534 --- /dev/null +++ b/exercise_4/workflow copy.yaml @@ -0,0 +1,43 @@ +name: Protected envs and stages + +on: + push: + branches: + - master + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout github repository + uses: actions/checkout@v4 + + - name: Build or simulate building + run: sleep 5 + + - name: Finish building + run: echo "Build completed successfully" + + deploy-to-environments: + needs: build-and-push + runs-on: ubuntu-latest + steps: + - name: Checkout github repository + uses: actions/checkout@v4 + + - name: Deploy to environments + uses: github/deployments@v1 + with: + environments: | + dev + int + prd + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }} + strategy: + type: sequential + approvals: + required: true + on_failure: + continue: never \ No newline at end of file