diff --git a/.github/workflows/main.yml b/.github/workflows/ci.yml similarity index 51% rename from .github/workflows/main.yml rename to .github/workflows/ci.yml index b127da20..d2f29765 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/ci.yml @@ -2,20 +2,17 @@ name: CI on: pull_request: - types: - - opened - - reopened - - synchronize - - ready_for_review push: - branches: "main" + branches: + - "main" + - "released" jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -25,6 +22,7 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 with: + version: 10.8.0 run_install: false - name: Setup Node @@ -40,10 +38,44 @@ jobs: run: bundle exec standardrb - name: Run tests - run: | - bin/rails test:prepare - bin/rails db:test:prepare - bin/rails test + run: bin/rails db:test:prepare test + + verify_components: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + run_install: false + + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version-file: ".node-version" + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build + run: bin/rails g ruby_ui:component:all --force true + + - uses: CatChen/check-git-status-action@v1 + with: + fail-if-not-clean: true + push-if-not-clean: false + request-changes-if-not-clean: false + targets: 'app' docker-build: if: github.ref == 'refs/heads/main' @@ -54,7 +86,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -73,13 +105,27 @@ jobs: next-deploy: if: github.ref == 'refs/heads/main' - needs: [test, docker-build] + needs: [test, docker-build, verify_components] runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Deploy to Heroku Prod + - name: Deploy to Heroku Next run: git push https://heroku:${{ secrets.HEROKU_RUBYUI_API_KEY }}@git.heroku.com/rubyui-next.git HEAD:main + + + released-deploy: + if: github.ref == 'refs/heads/released' + needs: [test] + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Deploy to Heroku Prod + run: git push https://heroku:${{ secrets.HEROKU_RUBYUI_API_KEY }}@git.heroku.com/rubyui.git HEAD:main diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index e8252856..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,17 +0,0 @@ -# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ - -name: Deploy -on: - workflow_dispatch: - -jobs: - deploy: - name: Deploy app - runs-on: ubuntu-latest - concurrency: deploy-group # optional: ensure only one action runs at a time - steps: - - uses: actions/checkout@v5 - - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --remote-only - env: - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/.github/workflows/verify_components.yml b/.github/workflows/verify_components.yml deleted file mode 100644 index 26280d4a..00000000 --- a/.github/workflows/verify_components.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Verify components - -on: - push: - branches: "main" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v5 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - run_install: false - - - name: Setup Node - uses: actions/setup-node@v6 - with: - node-version-file: ".node-version" - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build - run: bin/rails g ruby_ui:component:all --force true - - - uses: CatChen/check-git-status-action@v1 - with: - fail-if-not-clean: true - push-if-not-clean: false - request-changes-if-not-clean: false - targets: 'app' diff --git a/Gemfile b/Gemfile index f50f71f6..ab67e0cb 100644 --- a/Gemfile +++ b/Gemfile @@ -62,7 +62,6 @@ group :development do # Speed up commands on slow machines / big apps [https://github.com/rails/spring] # gem "spring" gem "standard" - gem "dockerfile-rails", ">= 1.6" end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index d58e7982..ab099810 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -124,8 +124,6 @@ GEM debug (1.11.0) irb (~> 1.10) reline (>= 0.3.8) - dockerfile-rails (1.7.10) - rails (>= 3.0.0) drb (2.2.3) erb (6.0.0) erubi (1.13.1) @@ -332,7 +330,6 @@ DEPENDENCIES capybara cssbundling-rails (= 1.4.3) debug - dockerfile-rails (>= 1.6) jsbundling-rails (= 1.3.1) lucide-rails (= 0.7.1) phlex!