sdcMerge branch 'testing' of https://github.com/feniln64/copypaste_re… #39
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
name: build-and-deploy | |
on: | |
push: | |
branches: ['main', 'testing'] | |
jobs: | |
docker-build-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitLb Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.gitlab.com | |
username: ${{ secrets.GITLAB_REGISTRY_USERNAME }} | |
password: ${{ secrets.GITLAB_REGISTRY_TOKEN }} | |
- name: list files | |
run: ls -al | |
- name: create .env file | |
run: | | |
echo "REACT_APP_POSTHOG_API_TOKEN=${{secrets.REACT_APP_POSTHOG_API_TOKEN}}" > .env | |
echo "REACT_APP_POSTHOG_URL=${{secrets.REACT_APP_POSTHOG_URL}}" >> .env | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: registry.gitlab.com/do-copypaste/copypaste_react:latest | |
# - name: build | |
# run: | | |
# docker buildx build -t ghcr.io/${{ github.repository_owner }}/copypaste_react:latest --push --platform=linux/arm64,linux/amd64 . | |
# docker build -t registry.gitlab.com/do-copypaste/copypaste_node:latest . | |
# docker push registry.gitlab.com/do-copypaste/copypaste_node:latest | |
# - name: Set up QEM | |
# uses: docker/setup-qemu-action@v2 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v2 | |
# - name: Build and push | |
# uses: docker/build-push-action@v3 | |
# with: | |
# context: . | |
# platforms: linux/amd64 | |
# push: true | |
# tags: registry.gitlab.com/do-copypaste/copypaste_node:latest | |
deploy: | |
needs: docker-build-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: multiple command | |
uses: appleboy/ssh-action@v0.1.10 | |
with: | |
host: ${{ secrets.HOSTNAME }} | |
username: ubuntu | |
key: ${{ secrets.SSH_KEY }} | |
port: 22 | |
script: | | |
ls -al | |
cd copypaste_react | |
ls | |
git pull | |
docker compose up -d --build | |
docker image prune -f |