Skip to content

Commit 7971a0d

Browse files
authored
merge deploy jobs again (#36)
1 parent fbe1587 commit 7971a0d

File tree

4 files changed

+65
-104
lines changed

4 files changed

+65
-104
lines changed

.github/workflows/deploy.development.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/deploy.production.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/deploy.staging.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Deploy
2+
3+
on:
4+
# Trigger a production deploymnent when a commit is pushed to the main branch
5+
push:
6+
branches:
7+
- main
8+
# Trigger a staging deployment when a pull request is merging
9+
merge_group:
10+
pull_request:
11+
# Trigger a development deployment when workflow is dispatched manually
12+
workflow_dispatch:
13+
14+
jobs:
15+
deploy_staging:
16+
strategy:
17+
matrix:
18+
environment: [production, staging, development]
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: ${{ matrix.environment }}
22+
url: https://test-github-features-${{ matrix.environment}}.fly.dev
23+
concurrency:
24+
group: ${{ matrix.environment }}
25+
cancel-in-progress: true
26+
steps:
27+
- name: Check
28+
id: check
29+
shell: bash
30+
run: |
31+
env = ${{ matrix.environment }}
32+
event = ${{ github.event_name }}
33+
continue = false
34+
35+
if [ $env == "staging" && $event == "merge_group" ]; then
36+
continue = true
37+
elif [ $env == "production" && $event == "push" ]; then
38+
continue = true
39+
elif [ $env == "development" && $event == "workflow_dispatch" ]; then
40+
continue = true
41+
fi
42+
43+
if [ $continue == false ]; then
44+
echo "Skipping deployment"
45+
fi
46+
47+
echo "continue=$continue" >> $GITHUB_OUTPUT
48+
49+
exit 1
50+
- uses: actions/checkout@v2
51+
- id: build
52+
if: ${{ steps.check.outputs.continue == 'true' }}
53+
uses: ./.github/actions/build
54+
with:
55+
push: true
56+
username: ${{ github.actor}}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Deploy
60+
if: ${{ steps.check.outputs.continue == 'true' }}
61+
uses: ./.github/actions/deploy
62+
with:
63+
environment: ${{ matrix.environment }}
64+
token: ${{ secrets.FLY_TOKEN }}
65+
image: ${{ steps.build.outputs.tags }}

0 commit comments

Comments
 (0)