Skip to content

Commit

Permalink
exercise 4 workflow.yaml creation
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorycottone committed May 17, 2024
1 parent 7f8662e commit 314c90a
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 43 additions & 0 deletions exercise_4/workflow copy.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 314c90a

Please sign in to comment.