-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (61 loc) · 2.26 KB
/
main.yml
File metadata and controls
67 lines (61 loc) · 2.26 KB
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
name: main
on:
pull_request:
types: [opened, closed]
branches:
- master
- alpha
jobs:
build:
runs-on: [self-hosted, stage]
if: github.event.pull_request.merged == false && github.event.action != 'closed'
environment: stage
steps:
- uses: actions/checkout@v3
- name: Docker login
run: echo "docker login --username ${{ secrets.CI_REGISTRY_USER }} --password ${{ secrets.CI_REGISTRY_PASSWORD }}"
- name: Build container
run: echo "docker build -t ${{ secrets.CI_REGISTRY_IMAGE }}:${{ github.event.pull_request.head.sha }} ."
- name: Push to Hub
run: echo "docker push ${{ secrets.CI_REGISTRY_IMAGE }}:${{ github.event.pull_request.head.sha }}"
stage:
runs-on: [self-hosted, stage]
environment: stage
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: CaptainOmega/test-github-workflows/.github/actions/deploy@master
env:
CI_REGISTRY_IMAGE: ${{ secrets.CI_REGISTRY_IMAGE }}
CI_REGISTRY_USER: ${{ secrets.CI_REGISTRY_USER }}
CI_REGISTRY_PASSWORD: ${{ secrets.CI_REGISTRY_PASSWORD }}
test:
runs-on: [self-hosted, stage]
environment: stage
needs: [stage]
steps:
- uses: actions/checkout@v3
- name: Run tests
run: echo "npm run e2e"
alpha:
runs-on: [self-hosted, alpha]
environment: alpha
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'alpha'
steps:
- uses: actions/checkout@v3
- uses: CaptainOmega/test-github-workflows/.github/actions/deploy@master
env:
CI_REGISTRY_IMAGE: ${{ secrets.CI_REGISTRY_IMAGE }}
CI_REGISTRY_USER: ${{ secrets.CI_REGISTRY_USER }}
CI_REGISTRY_PASSWORD: ${{ secrets.CI_REGISTRY_PASSWORD }}
prod:
runs-on: [self-hosted, prod]
environment: prod
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master'
steps:
- uses: actions/checkout@v3
- uses: CaptainOmega/test-github-workflows/.github/actions/deploy@master
env:
CI_REGISTRY_IMAGE: ${{ secrets.CI_REGISTRY_IMAGE }}
CI_REGISTRY_USER: ${{ secrets.CI_REGISTRY_USER }}
CI_REGISTRY_PASSWORD: ${{ secrets.CI_REGISTRY_PASSWORD }}