Skip to content

[#492][CRUD] Add the index view templates to the generator (#505) #3

[#492][CRUD] Add the index view templates to the generator (#505)

[#492][CRUD] Add the index view templates to the generator (#505) #3

name: Test Production Docker Build
on: push
env:
APP_NAME: rails_templates
DOCKER_IMAGE: ${{ github.repository }}
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }}
RUBY_VERSION: 3.2.2
NODE_VERSION: 18
RAILS_VERSION: 7.1.2
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_production:
name: ${{ matrix.variant }} variant
runs-on: ubuntu-latest
strategy:
matrix:
variant: [web, api]
steps:
- uses: actions/checkout@v3
- name: Set env BRANCH_TAG
uses: nimblehq/branch-tag-action@1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache gems
uses: actions/cache@v3
with:
path: /home/runner/.rubies/ruby-${{ env.RUBY_VERSION }}
key: ${{ runner.os }}-gems-${{ env.RUBY_VERSION }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ env.RUBY_VERSION }}-
- name: Create app folder
run: mkdir $APP_NAME
- name: Get yarn cache directory path
if: ${{ matrix.variant == 'web' }}
id: yarn-cache-dir-path
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache npm packages
if: ${{ matrix.variant == 'web' }}
uses: actions/cache@v3
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.yarn_cache_dir }}
**/yarn.lock
**/node_modules
key: ${{ runner.os }}-npm-packages-${{ hashFiles('**/package.json*') }}
restore-keys: |
${{ runner.os }}-npm-packages-
- name: Create rails app
run: |
gem install rails -v ${{ env.RAILS_VERSION }} --no-document
make create_${{ matrix.variant }}
- name: Build production image
run: |
export BRANCH_TAG=${{ env.BRANCH_TAG }}-${{ matrix.variant }}
make build_production