This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 174
106 lines (88 loc) · 2.96 KB
/
push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Continuous integration
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
redis:
image: redis:alpine
ports: ["6379:6379"]
opensearch:
image: opensearchproject/opensearch:latest
ports: ["9200:9200"]
env:
discovery.type: single-node
plugins.security.disabled: true
env:
RUBY_YJIT_ENABLE: 1
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Lint with RuboCop
run: bundle exec rubocop --parallel
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
cache: yarn
- name: Install Node modules
run: bin/yarn install --frozen-lockfile
- name: Run ESLint
run: bin/yarn lint
- name: Run Tests
env:
DB_HOST: localhost
DB_USER: postgres
DB_PASSWORD: postgres
RAILS_ENV: test
SECRET_KEY_BASE: we-dont-need-a-secret-here
APP_ADMIN_EMAIL: admin@example.org
APP_ADMIN_PASSWORD: secret
APP_EMAIL: reply@example.org
APP_HOST: example.org
AWS_ACCESS_KEY_ID: my-access-key
AWS_SECRET_ACCESS_KEY: my-secret
AWS_BUCKET: my-bucket
AWS_REGION: eu-central-1
CI: true
NODE_OPTIONS: '--openssl-legacy-provider'
run: |
bundle exec rake assets:precompile
bundle exec rake db:create db:schema:load
bundle exec rake spec
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
needs: test
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build, push and deploy the LATEST image
if: github.ref == 'refs/heads/develop'
run: |
export COMMIT_TIME=$(git show -s --format=%cD ${GITHUB_SHA})
export COMMIT_SHA=${GITHUB_SHA}
docker buildx build --build-arg COMMIT_TIME --build-arg COMMIT_SHA -t ghcr.io/ledermann/docker-rails/docker-rails:latest .
docker push ghcr.io/ledermann/docker-rails/docker-rails:latest
curl -X POST ${{ secrets.DEPLOY_HOOK_APP }}
curl -X POST ${{ secrets.DEPLOY_HOOK_WORKER }}
- name: Build and push the STABLE image
if: github.ref == 'refs/heads/master'
run: |
docker buildx build -t ghcr.io/ledermann/docker-rails/docker-rails:stable .
docker push ghcr.io/ledermann/docker-rails/docker-rails:stable