some changes in audio #394
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: Despliegue a Azure y ejecución de testss | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test_and_deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
run: npm test | |
- name: Set commit status | |
if: always() | |
uses: EndBug/add-and-commit@v7 | |
with: | |
add: "." | |
message: "Tests passed" | |
author_name: "Garicore01" | |
author_email: "[email protected]" | |
author_date: "$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
deploy_to_azure: | |
needs: test_and_deploy | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.test_and_deploy.result == 'success' }} | |
steps: | |
- name: webfactory/ssh-agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.AZURE_SECRET_KEY }} | |
host: ${{ secrets.AZURE_HOST }} | |
username: ${{ secrets.AZURE_USER }} | |
- name: Desplegar a Azure | |
run: | | |
ssh -o StrictHostKeyChecking=no -t ${{ secrets.AZURE_USER }}@${{ secrets.AZURE_HOST }} "cd playbeat/Backend && git pull origin main && | |
docker stop playbeat_container && docker rm playbeat_container && docker rmi playbeat && docker build -t playbeat:latest . && | |
docker run -v audios_playbeat:/app/audios -v img_playbeat:/app/img -d --name playbeat_container -p 3000:3000 -p 3001:3001 playbeat:latest" |