diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml new file mode 100644 index 00000000..a5aa8656 --- /dev/null +++ b/.gitea/workflows/build-deploy.yml @@ -0,0 +1,62 @@ +name: Build & Deploy OS League Tools + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ["cicd"] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: os-league-tools-master/package-lock.json + + - name: Install dependencies + working-directory: os-league-tools-master + run: npm ci + + - name: Build production bundle + working-directory: os-league-tools-master + run: npm run build + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: frontend-build + path: os-league-tools-master/build/ + + deploy: + runs-on: [frontend] + needs: build + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: frontend-build + path: /home/sonder/deploy/os-league-tools-build + + - name: List deploy directory + run: ls -al /home/sonder/deploy/os-league-tools-build + + - name: Stop service + run: sudo systemctl stop os-league-tools || true + + - name: Deploy new build + run: | + sudo rm -rf /home/sonder/leagues-tools/os-league-tools-master/build + sudo cp -r /home/sonder/deploy/os-league-tools-build /home/sonder/leagues-tools/os-league-tools-master/build + sudo chown -R sonder:sonder /home/sonder/leagues-tools/os-league-tools-master/build + + - name: Start service + run: sudo systemctl start os-league-tools + + - name: Cleanup deploy artifacts + run: rm -rf /home/sonder/deploy/os-league-tools-build diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 00000000..bef9b6ef --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,24 @@ +name: Build and Deploy to GH Pages +on: [workflow_dispatch] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install and build + run: | + npm install + npm run build + env: + REACT_APP_GA_MID: ${{ secrets.REACT_APP_GA_MID }} + + - name: Deploy to GitHub Pages + if: success() + uses: crazy-max/ghaction-github-pages@v2 + with: + target_branch: gh-pages + build_dir: build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}