Skip to content

Commit

Permalink
Update deployment of static site to heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Dec 9, 2024
1 parent f40010b commit 059430e
Showing 1 changed file with 1 addition and 91 deletions.
92 changes: 1 addition & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,104 +10,14 @@ concurrency:
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: x
AWS_SECRET_ACCESS_KEY: x
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: restyled_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- run: db/migrate test upgrade
- id: stack
uses: freckle/stack-action@v5
env:
REDIS_URL: redis://localhost:6379/15
- run: db/migrate prod check
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- uses: freckle/weeder-action@v2
with:
ghc-version: ${{ steps.stack.outputs.compiler-version }}

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: warning

image:
runs-on: ubuntu-latest

outputs:
image: ${{ steps.prep.outputs.image }}

steps:
- id: prep
run: |
{
printf 'image=restyled/restyled.io:'
echo "${{ github.sha }}" | head -c7
} >>"$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- uses: docker/build-push-action@v5
with:
build-args: |
REVISION=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.prep.outputs.image }}

deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest

needs: [build, image]

steps:
- run: |
cat >Dockerfile.web <<'EOM'
FROM ${{ needs.image.outputs.image }}
CMD ["/app/restyled.io"]
EOM
- uses: gonuit/[email protected]
with:
email: ${{ secrets.HEROKU_EMAIL }}
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: restyled-io
dockerfile_name: Dockerfile.web
dockerfile_name: web.dockerfile

0 comments on commit 059430e

Please sign in to comment.