chore: configure deployment on NERC #1
Workflow file for this run
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: client | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "**" | |
branches: | |
- main | |
tags: | |
- "s*.*.*" | |
- "v*.*.*" | |
pull_request: | |
paths: | |
- "**" | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
# deployment on staging server | |
- name: Build & Push Docker Staging Build | |
uses: docker/build-push-action@v4 | |
if: startsWith(github.ref, 'refs/tags/s') | |
with: | |
context: . | |
tags: hicsail/cycm-ionic:staging | |
build-args: | | |
VITE_ELEVEN_LABS_API_KEY=${{ secrets.VITE_ELEVEN_LABS_API_KEY }} | |
VITE_STRAPY_TOKEN=${{ secrets.VITE_STRAPY_TOKEN }} | |
VITE_STRAPI_URL=${{ secrets.VITE_STRAPI_URL }} | |
- name: Push to Staging | |
uses: fjogeleit/http-request-action@v1 | |
if: startsWith(github.ref, 'refs/tags/s') | |
with: | |
method: "POST" | |
url: ${{ secrets.PORTAINER_WEBHOOK_STAGING }} | |
preventFailureOnReponse: true | |
# deployment on production server | |
- name: Build & Push Docker Production Build | |
uses: docker/build-push-action@v4 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
context: . | |
tags: hicsail/cycm-ionic:prod | |
build-args: | | |
VITE_ELEVEN_LABS_API_KEY=${{ secrets.VITE_ELEVEN_LABS_API_KEY_PROD }} | |
VITE_STRAPY_TOKEN=${{ secrets.VITE_STRAPY_TOKEN_PROD }} | |
VITE_STRAPI_URL=${{ secrets.VITE_STRAPI_URL_PROD }} | |
- name: Push to Production | |
uses: fjogeleit/http-request-action@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
method: "POST" | |
url: ${{ secrets.PORTAINER_WEBHOOK_PRODUCTION }} | |
preventFailureOnReponse: true |