chore: don't rely on custom fns jsonb_array_max, jsonb_array_avg #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Migrate Database and Deploy | |
# This workflow is triggered on pushes to the repository. | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
env: | |
NO_COLOR: true | |
CI: 1 | |
NEXT_TELEMETRY_DISABLED: 1 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SSH_KEY_ORB_UBUNTU: ${{ secrets.SSH_KEY_ORB_UBUNTU }} | |
HOST_IP: ${{ secrets.HOST_IP }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_PORT: ${{ secrets.SSH_PORT }} | |
KAMAL_REGISTRY_USERNAME: ${{ secrets.KAMAL_REGISTRY_USERNAME }} | |
KAMAL_REGISTRY_PASSWORD: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} | |
jobs: | |
build: | |
name: Deploy | |
if: github.ref == 'refs/heads/main' | |
timeout-minutes: 30 | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
bundler-cache: true | |
- name: Install dependencies | |
run: | | |
gem install kamal -v 1.3.1 | |
- name: Turnstyle | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx for cache | |
uses: docker/setup-buildx-action@v3 | |
- name: Expose GitHub Runtime for cache | |
uses: crazy-max/ghaction-github-runtime@v3 | |
- name: Write ENV | |
run: | | |
echo "${{ secrets.ENV_BASE64 }}" | base64 -d > .env | |
cat .env | |
- name: SSH Keyscan | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_KEY_ORB_UBUNTU" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -p ${{ env.SSH_PORT }} ${{ env.HOST_IP }} >> ~/.ssh/known_hosts | |
- name: SSH Run Command | |
run: | | |
ssh -p ${{ env.SSH_PORT }} ${{ env.SSH_USER }}@${{ env.HOST_IP }} "ls" | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: Kamal Deploy | |
run: | | |
kamal env push | |
kamal deploy |