Skip to content

Commit 91de69b

Browse files
authored
Refactor GitHub Actions workflows (#236)
Update GitHub Actions configuration by: 1. Renaming fly-deploy.yml to deploy.yml 2. Changing deploy workflow to manual trigger (workflow_dispatch) 3. Updating CI workflow configuration
1 parent 68422c5 commit 91de69b

File tree

2 files changed

+57
-33
lines changed

2 files changed

+57
-33
lines changed

.github/workflows/fly-deploy.yml renamed to .github/workflows/deploy.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
22

3-
name: Fly Deploy
3+
name: Deploy
44
on:
5-
push:
6-
branches:
7-
- main
5+
workflow_dispatch:
6+
87
jobs:
98
deploy:
109
name: Deploy app

.github/workflows/main.yml

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,51 @@ on:
1111
branches: "main"
1212
jobs:
1313
test:
14-
timeout-minutes: 15
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
bundler-cache: true
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
run_install: false
29+
30+
- name: Setup Node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version-file: ".node-version"
34+
cache: 'pnpm'
35+
36+
- name: Install dependencies
37+
run: |
38+
# sudo apt-get update
39+
# sudo apt-get install -y -qq libvips
40+
pnpm install
41+
42+
- name: Lint code for consistent style
43+
run: bundle exec standardrb
44+
45+
- name: Build and run dev container task
46+
uses: devcontainers/[email protected]
47+
with:
48+
imageName: ghcr.io/ruby-ui/web-devcontainer
49+
cacheFrom: ghcr.io/ruby-ui/web-devcontainer
50+
push: always
51+
runCmd: |
52+
bundle exec standardrb
53+
bin/rails test:prepare
54+
bin/rails db:test:prepare
55+
bin/rails test
56+
57+
docker-build:
58+
if: github.ref == 'refs/heads/main'
1559
runs-on: ubuntu-latest
1660
permissions:
1761
contents: read
@@ -34,36 +78,17 @@ jobs:
3478
imageName: ghcr.io/ruby-ui/web-devcontainer
3579
cacheFrom: ghcr.io/ruby-ui/web-devcontainer
3680
push: always
37-
runCmd: |
38-
bundle exec standardrb
39-
bin/rails test:prepare
40-
bin/rails db:test:prepare
41-
bin/rails test
81+
4282

43-
heroku-deploy:
44-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/PhlexUI-web' }}
45-
needs: [test]
83+
next-deploy:
84+
if: github.ref == 'refs/heads/main'
85+
needs: [test, docker-build]
4686
runs-on: ubuntu-latest
4787

4888
steps:
49-
- uses: actions/checkout@v4
50-
- name: Deploy to Heroku
51-
uses: akhileshns/[email protected]
89+
- name: Checkout code
90+
uses: actions/checkout@v4
5291
with:
53-
branch: PhlexUI-web
54-
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
55-
heroku_app_name: "phlex-ui-web"
56-
heroku_email: "[email protected]"
57-
58-
fly-deploy:
59-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
60-
needs: [test]
61-
name: Deploy app
62-
runs-on: ubuntu-latest
63-
concurrency: deploy-group
64-
steps:
65-
- uses: actions/checkout@v4
66-
- uses: superfly/flyctl-actions/setup-flyctl@master
67-
- run: flyctl deploy --remote-only
68-
env:
69-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
92+
fetch-depth: 0
93+
- name: Deploy to Heroku Prod
94+
run: git push https://heroku:${{ secrets.HEROKU_RUBYUI_API_KEY }}@git.heroku.com/rubyui-next.git HEAD:main

0 commit comments

Comments
 (0)