Skip to content

Commit ae0738d

Browse files
authored
Unify GitHub Actions workflows and add production deployment support (#368)
* Unify GitHub Actions workflows and add production deployment support * Upgrade GitHub Actions to v6 * fix
1 parent e0b03cb commit ae0738d

File tree

5 files changed

+61
-78
lines changed

5 files changed

+61
-78
lines changed

.github/workflows/main.yml renamed to .github/workflows/ci.yml

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@ name: CI
22

33
on:
44
pull_request:
5-
types:
6-
- opened
7-
- reopened
8-
- synchronize
9-
- ready_for_review
105
push:
11-
branches: "main"
6+
branches:
7+
- "main"
8+
- "released"
129
jobs:
1310
test:
1411
runs-on: ubuntu-latest
1512

1613
steps:
1714
- name: Checkout code
18-
uses: actions/checkout@v5
15+
uses: actions/checkout@v6
1916

2017
- name: Set up Ruby
2118
uses: ruby/setup-ruby@v1
@@ -25,6 +22,7 @@ jobs:
2522
- name: Install pnpm
2623
uses: pnpm/action-setup@v4
2724
with:
25+
version: 10.8.0
2826
run_install: false
2927

3028
- name: Setup Node
@@ -40,10 +38,44 @@ jobs:
4038
run: bundle exec standardrb
4139

4240
- name: Run tests
43-
run: |
44-
bin/rails test:prepare
45-
bin/rails db:test:prepare
46-
bin/rails test
41+
run: bin/rails db:test:prepare test
42+
43+
verify_components:
44+
if: github.ref == 'refs/heads/main'
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v6
50+
51+
- name: Set up Ruby
52+
uses: ruby/setup-ruby@v1
53+
with:
54+
bundler-cache: true
55+
56+
- name: Install pnpm
57+
uses: pnpm/action-setup@v4
58+
with:
59+
run_install: false
60+
61+
- name: Setup Node
62+
uses: actions/setup-node@v6
63+
with:
64+
node-version-file: ".node-version"
65+
cache: 'pnpm'
66+
67+
- name: Install dependencies
68+
run: pnpm install
69+
70+
- name: Build
71+
run: bin/rails g ruby_ui:component:all --force true
72+
73+
- uses: CatChen/check-git-status-action@v1
74+
with:
75+
fail-if-not-clean: true
76+
push-if-not-clean: false
77+
request-changes-if-not-clean: false
78+
targets: 'app'
4779

4880
docker-build:
4981
if: github.ref == 'refs/heads/main'
@@ -54,7 +86,7 @@ jobs:
5486

5587
steps:
5688
- name: Checkout code
57-
uses: actions/checkout@v5
89+
uses: actions/checkout@v6
5890

5991
- name: Login to GitHub Container Registry
6092
uses: docker/login-action@v3
@@ -73,13 +105,27 @@ jobs:
73105

74106
next-deploy:
75107
if: github.ref == 'refs/heads/main'
76-
needs: [test, docker-build]
108+
needs: [test, docker-build, verify_components]
77109
runs-on: ubuntu-latest
78110

79111
steps:
80112
- name: Checkout code
81-
uses: actions/checkout@v5
113+
uses: actions/checkout@v6
82114
with:
83115
fetch-depth: 0
84-
- name: Deploy to Heroku Prod
116+
- name: Deploy to Heroku Next
85117
run: git push https://heroku:${{ secrets.HEROKU_RUBYUI_API_KEY }}@git.heroku.com/rubyui-next.git HEAD:main
118+
119+
120+
released-deploy:
121+
if: github.ref == 'refs/heads/released'
122+
needs: [test]
123+
runs-on: ubuntu-latest
124+
125+
steps:
126+
- name: Checkout code
127+
uses: actions/checkout@v6
128+
with:
129+
fetch-depth: 0
130+
- name: Deploy to Heroku Prod
131+
run: git push https://heroku:${{ secrets.HEROKU_RUBYUI_API_KEY }}@git.heroku.com/rubyui.git HEAD:main

.github/workflows/deploy.yml

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

.github/workflows/verify_components.yml

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

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ group :development do
6262
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
6363
# gem "spring"
6464
gem "standard"
65-
gem "dockerfile-rails", ">= 1.6"
6665
end
6766

6867
group :test do

Gemfile.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ GEM
124124
debug (1.11.0)
125125
irb (~> 1.10)
126126
reline (>= 0.3.8)
127-
dockerfile-rails (1.7.10)
128-
rails (>= 3.0.0)
129127
drb (2.2.3)
130128
erb (6.0.0)
131129
erubi (1.13.1)
@@ -332,7 +330,6 @@ DEPENDENCIES
332330
capybara
333331
cssbundling-rails (= 1.4.3)
334332
debug
335-
dockerfile-rails (>= 1.6)
336333
jsbundling-rails (= 1.3.1)
337334
lucide-rails (= 0.7.1)
338335
phlex!

0 commit comments

Comments
 (0)