Skip to content

Commit

Permalink
Merge pull request #499 from frontendnetwork/staging
Browse files Browse the repository at this point in the history
Staging → Main
  • Loading branch information
philipbrembeck authored Oct 19, 2023
2 parents f73c3c8 + 6418fb1 commit 3370225
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 151 deletions.
58 changes: 48 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: Create and publish a Docker image
on:
push:
branches:
- main
- release
- staging
- main
- release
- staging

env:
REGISTRY: ghcr.io
Expand All @@ -22,7 +22,7 @@ jobs:
contents: read
packages: write

environment:
environment:
name: Production
url: https://vegancheck.me

Expand All @@ -47,24 +47,43 @@ jobs:
run: cp .env.main .env

- name: Build and push Docker image
uses: docker/build-push-action@9311bf5263ae5b36f3ec67aff768790c6e2344ad
id: build-prod
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


deploy-prod:
needs: build-and-push-prod
if: success() && github.ref != 'refs/heads/staging'
runs-on: ubuntu-latest

steps:
- name: SSH into the server and run Docker Compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd vegancheck
docker-compose stop vc-frontend
docker-compose pull vc-frontend
docker-compose up -d vc-frontend
build-and-push-staging:
if: github.ref == 'refs/heads/staging'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

environment:
environment:
name: Staging
url: https://staging.vegancheck.me

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -83,15 +102,34 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Setup Staging Env
run: cp .env.development .env
run: cp .env.development .env

- name: Display .env contents
run: cat .env

- name: Build and push Docker image
uses: docker/build-push-action@9311bf5263ae5b36f3ec67aff768790c6e2344ad
id: build-staging
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy-staging:
needs: build-and-push-staging
if: success() && github.ref == 'refs/heads/staging'
runs-on: ubuntu-latest

steps:
- name: SSH into the server and run Docker Compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd vegancheck
docker-compose stop vc-frontend
docker-compose pull vc-frontend
docker-compose up -d vc-frontend
25 changes: 0 additions & 25 deletions .github/workflows/release.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/staging.txt

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
.DS_Store
*.pem
.icloud
*.icloud
*/*.icloud

# debug
npm-debug.log*
Expand Down
40 changes: 23 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/react-dom": "18.2.7",
"eslint-config-sznm": "^2.0.2",
"jest-worker": "^29.6.2",
"million": "^2.5.13",
"million": "^2.6.4",
"next": "13.4.16",
"next-intl": "^2.19.1",
"next-pwa": "^5.6.0",
Expand Down
Loading

0 comments on commit 3370225

Please sign in to comment.