diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..0a7117d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,56 @@ +--- +name: Docker + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - run: | + make setup + bin/rails assets:precompile + make test + + docker: + needs: build + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + cache-from: ghcr.io/${{ github.repository }}:latest + cache-to: type=inline + tags: ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 052fe06..54634e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ --- -name: Main +name: Render on: pull_request: @@ -15,17 +15,19 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' + - uses: ruby/setup-ruby@v1 with: + ruby-version: '3.3' bundler-cache: true - run: | make setup - bin/rails assets:precompile make test deploy: @@ -36,20 +38,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - push: true - cache-from: ghcr.io/${{ github.repository }}:latest - cache-to: type=inline - tags: ghcr.io/${{ github.repository }}:latest \ No newline at end of file + - name: Deploy + run: | + curl ${{ secrets.RENDER_DEPLOY_HOOK_URL }} diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 9e79f6c..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-3.2.2 diff --git a/Gemfile b/Gemfile index 04641ee..ccf5189 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '~> 3.2.2' +ruby '~> 3.3.4' gem 'bootsnap', require: false gem 'cssbundling-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 784f3d0..f5c37d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -135,6 +135,7 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) + mini_portile2 (2.8.8) minitest (5.19.0) minitest-power_assert (0.3.1) minitest @@ -150,7 +151,8 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.3-x86_64-linux) + nokogiri (1.15.3) + mini_portile2 (~> 2.8.2) racc (~> 1.4) parallel (1.23.0) parser (3.2.2.3) @@ -279,7 +281,8 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.3-x86_64-linux) + sqlite3 (1.6.3) + mini_portile2 (~> 2.8.0) stimulus-rails (1.2.1) railties (>= 6.0.0) syntax_tree (6.1.1) @@ -350,7 +353,7 @@ DEPENDENCIES webdrivers RUBY VERSION - ruby 3.2.1p31 + ruby 3.3.4p94 BUNDLED WITH 2.4.6 diff --git a/Makefile b/Makefile index 8b64a56..49a5e7c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,19 @@ +render-build: + bundle install + bundle exec rails assets:precompile + bundle exec rails assets:clean + bundle exec rails db:migrate + +render-start: + bin/rails server + start: rm -rf tmp/pids/server.pid || true bin/rails s -setup: install db-prepare + +setup: install + bin/rails assets:precompile + make db-prepare install: bin/setup @@ -29,5 +41,4 @@ compose-production-run-app: compose-production-console: docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml exec app bin/rails console - .PHONY: test diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc deleted file mode 100644 index cef17dd..0000000 --- a/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -5HTkGKHNRrL3DklAXMTX0o1zZAsr1t0HqKyHGTiiwgDnkriGO5gBEzJ7PUP8HV2fMsMj1gbavKxmPqYkxE4Batx1Ai712aieSPcO4dcI5YCS0EqnV1IhPXMEnAzEEgQDkK4O6uwJAzIsPWeKvgcOy6KInG4ndlEsc8XQ1UeM7c8h1wZcSTPyMaSEWD132aqutYNnGeiwvgtCcLU4IZDwr65ivNHFE4MT1lowKvdXnXOrdGIneouByeoQOT75nHdOvNQ4qX2EBOSzlrTxHCEOTJdzO/p+pkPW9ZzprkpWjAE/YImaguJ+Yb6pKWTRqRzGqLHBCD2WZrvKP/uUEHRPpEXXRMvsQ1QdVm/ZHmkfPJi92m56S13NQzRNkiSFX7oTCASOGsqgXxPxOLd1PWhPPMktVhR0zadDvmE0--mQf8dTP1choODJ7s--clkFheRvnbCGm+D1hKZNPQ== \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index d7bc7cf..993b30b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -22,4 +22,4 @@ test: production: <<: *default - url: db/production.sqlite3 + url: <%= ENV['DATABASE_URL'] %>