diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8c68fa..4bc45c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,21 +1,42 @@ -name: La Fresca Frontend Build +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to server on: + # Runs on pushes targeting the default branch push: branches: ['main'] - pull_request: - branches: ['main'] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: build: runs-on: ubuntu-latest - timeout-minutes: 20 steps: - - name: Frontend-Build - uses: appleboy/ssh-action@v1.0.3 + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Make envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_VITE_API_URL: 'https://lafresca-api.ucsc.eu.org/api/lafresca' + envkey_VITE_UPLOAD_URL: ${{ secrets.UPLOAD_URL }} + envkey_COOKIE_PROTOCOL: 'https:' + file_name: .env + - name: Build + run: npm run build + - name: Upload artifact + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} - script: ./lafresca-frontend-action.sh + source: './dist' + target: '/var/www/lafresca-frontend/html' + rm: true diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml deleted file mode 100644 index 86c3dc2..0000000 --- a/.github/workflows/static.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to server - -on: - # Runs on pushes targeting the default branch - push: - branches: ['main', 'dev'] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Make envfile - uses: SpicyPizza/create-envfile@v2.0 - with: - envkey_VITE_API_URL: 'https://lafresca-api.ucsc.eu.org/api/lafresca' - envkey_VITE_UPLOAD_URL: ${{ secrets.UPLOAD_URL }} - envkey_COOKIE_PROTOCOL: 'https:' - file_name: .env - - name: Build - run: npm run build - - name: Upload artifact - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: './dist' - target: '/var/www/lafresca-frontend/html' - rm: true