generated from ps-actions-sandbox/ActionsFundamentals
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.12 KB
/
github-actions-demo.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
# This is a basic workflow to help you get started with Actions
name: GitHub Actions Demo
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
paths-ignore: [ .github/** ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '15 6 * * 0'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
type: environment
required: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Build:
runs-on: ubuntu-latest
steps:
- run: |
echo "🎉 The job was triggered by event: ${{ github.event_name }}"
echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- uses: actions/checkout@v3.0.2
- name: List files in the repository
run: |
echo "The repository ${{ github.repository }} contains the following files:"
tree
Test:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
needs: Build
environment: Test
steps:
- run: echo "🧪 Testing..."
Load-Test:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
needs: Build
environment: Load-Test
steps:
- run: |
echo "🧪 Testing..."
sleep 15
Production:
runs-on: ubuntu-latest
needs: [Test, Load-Test]
environment:
name: Production
url: https://writeabout.net
if: github.event.inputs.environment == 'Production'
steps:
- run: |
echo "🚀 Step 1..."
sleep 10
- run: |
echo "🚀 Step 2..."
sleep 10
- run: |
echo "🚀 Step 3..."
sleep 10
- run: |
echo "🚀 Step 4..."
sleep 10
- run: |
echo "🚀 Step 5..."
sleep 10