Merge pull request #474 from postalsys/release-please--branches--mast… #1083
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
on: | |
push: | |
branches: | |
- master | |
name: Deploy test instance and Docker image | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
name: Deploy Demo App | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
- name: Deploy to server | |
env: | |
TARGET_HOST_02: dev.emailengine.app | |
NODE_ENV: production | |
SERVICE_NAME: emailengine | |
id: deploy | |
run: | | |
echo $GITHUB_SHA > commit.txt | |
./update-info.sh | |
npm install --omit=dev | |
tar czf /tmp/${SERVICE_NAME}.tar.gz --exclude .git . | |
scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" /tmp/${SERVICE_NAME}.tar.gz deploy@${TARGET_HOST_02}: | |
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" deploy@$TARGET_HOST_02 "/opt/deploy.sh ${SERVICE_NAME}" | |
- name: Deploy to demo server | |
env: | |
TARGET_HOST_02: dev.emailengine.app | |
NODE_ENV: production | |
SERVICE_NAME: emailengine-demo | |
id: deploy-demo | |
run: | | |
echo $GITHUB_SHA > commit.txt | |
./update-info.sh | |
npm install --omit=dev | |
tar czf /tmp/${SERVICE_NAME}.tar.gz --exclude .git . | |
scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" /tmp/${SERVICE_NAME}.tar.gz deploy@${TARGET_HOST_02}: | |
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" deploy@$TARGET_HOST_02 "/opt/deploy.sh ${SERVICE_NAME}" | |
docker: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/arm64,linux/amd64,linux/arm/v7 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ github.repository }} | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=latest,enable=true | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: ${{ steps.buildx.outputs.platforms }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |