Skip to content

Commit 394741a

Browse files
authored
MErge deploy jobs add dev environment (#29)
1 parent 8467729 commit 394741a

File tree

4 files changed

+52
-59
lines changed

4 files changed

+52
-59
lines changed

.github/workflows/push.yml renamed to .github/workflows/deploy.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
1-
name: Push
1+
name: Deploy
22

33
on:
4+
workflow_dispatch:
5+
merge_group:
6+
pull_request:
47
push:
58
branches:
69
- main
710

8-
env:
9-
environment: production
10-
1111
jobs:
12-
log:
12+
environment:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Log event
15+
- id: environment
16+
shell: bash
1617
run: |
17-
echo "json: ${{ github }}"
18-
printenv
19-
deploy_production:
18+
if [[ ${{ github.event_name }} == 'push' ]]; then
19+
echo "environment=production" >> $GITHUB_OUTPUT
20+
echo "url=https://test-github-features.fly.dev" >> $GITHUB_OUTPUT
21+
elif [[ ${{ github.event_name }} == 'merge_group' ]]; then
22+
echo "environment=staging" >> $GITHUB_OUTPUT
23+
echo "url=https://test-github-features-staging.fly.dev" >> $GITHUB_OUTPUT
24+
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
25+
echo "environment=development" >> $GITHUB_OUTPUT
26+
echo "url=https://test-github-features-staging.fly.dev" >> $GITHUB_OUTPUT
27+
fi
28+
deploy:
29+
needs: environment
30+
if: ${{ needs.environment.outputs.environment }}
31+
environment:
32+
name: ${{ needs.environment.outputs.environment }}
33+
url: ${{ needs.environment.outputs.environment }}.example.com
2034
runs-on: ubuntu-latest
35+
concurrency:
36+
group: ${{ github.event_name }}
37+
cancel-in-progress: true
2138
steps:
2239
- uses: actions/checkout@v2
2340
- id: build
@@ -27,10 +44,10 @@ jobs:
2744
username: ${{ github.actor}}
2845
password: ${{ secrets.GITHUB_TOKEN }}
2946

30-
- name: Deploy to (production)
47+
- name: Deploy
3148
uses: ./.github/actions/deploy
3249
with:
33-
config: ${{ github.workspace }}/fly-${{ env.environment }}.toml
50+
config: ${{ github.workspace }}/fly-${{ needs.environment.outputs.environment}}.toml
3451
token: ${{ secrets.FLY_TOKEN }}
3552
image: ${{ steps.build.outputs.tags }}
3653
- id: pr_url

.github/workflows/merge.yml

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

fly-development.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# fly.toml app configuration file generated for test-github-features-staging on 2024-03-15T14:31:33+01:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'test-github-features-development'
7+
primary_region = 'ams'
8+
9+
[build]
10+
image = 'ghcr.io/mozilla/test-github-features:latest'
11+
12+
[http_service]
13+
internal_port = 3000
14+
force_https = true
15+
auto_stop_machines = true
16+
auto_start_machines = true
17+
min_machines_running = 0
18+
processes = ['app']
19+
20+
[[vm]]
21+
memory = '1gb'
22+
cpu_kind = 'shared'
23+
cpus = 1

fly-staging.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ app = 'test-github-features-staging'
77
primary_region = 'ams'
88

99
[build]
10-
image = 'ghcr.io/mozilla/test-github-features:staging'
10+
image = 'ghcr.io/mozilla/test-github-features:latest'
1111

1212
[http_service]
1313
internal_port = 3000

0 commit comments

Comments
 (0)