Localization fixes #106
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
# ## NOTE | |
# | |
# - env (prod, staging) is different from MIX_ENV which will always be prod | |
name: Staging | |
on: | |
push: | |
branches: | |
- staging | |
jobs: | |
build: | |
name: Deploy | |
strategy: | |
matrix: | |
app: [pairs_one] | |
host: [staging.pairs.one] | |
env: [staging] | |
os: [ubuntu-latest] | |
port: [8015] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GHCR | |
run: echo "${{secrets.GITHUB_TOKEN}}" | docker login https://ghcr.io -u ${{github.actor}} --password-stdin | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ghcr.io/mxgrn/${{matrix.app}}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Pull image on host and restart | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{secrets.APP_HOSTS}} | |
sync: true | |
username: deploy | |
key: ${{ secrets.DEPLOYMENT_KEY }} | |
script_stop: true | |
script: | | |
echo "${{secrets.GITHUB_TOKEN}}" | docker login https://ghcr.io -u ${{github.actor}} --password-stdin | |
docker pull ghcr.io/mxgrn/${{matrix.app}} | |
docker stop ${{matrix.app}}_${{matrix.env}} || true | |
docker rm ${{matrix.app}}_${{matrix.env}} || true | |
docker run --name=${{matrix.app}}_${{matrix.env}} -d \ | |
--restart always \ | |
--network host \ | |
-e PORT=${{matrix.port}} \ | |
-e SECRET_KEY_BASE=${{secrets.SECRET_KEY_BASE}} \ | |
-e REDIS_URI=${{secrets.REDIS_URI_STAGING}} \ | |
-e GITHUB_SHA=${{github.sha}} \ | |
-e SENTRY_DSN=${{secrets.SENTRY_DSN}} \ | |
-e RELEASE_COOKIE=${{secrets.RELEASE_COOKIE_STAGING}} \ | |
-e PHX_HOST=${{matrix.host}} \ | |
-e DOCKER_CONTAINER=${{matrix.app}}_${{matrix.env}} \ | |
-e PROD_ENV=${{matrix.env}} \ | |
ghcr.io/mxgrn/${{matrix.app}} | |
while [ "`docker inspect -f {{.State.Running}} ${{matrix.app}}_${{matrix.env}}`" != "true" ]; do sleep 1; done | |
sleep 10 | |
echo "Done." |