workflow fix attempt #2
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: Deploy Backend | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
test: # just make sure the node server can be run | |
defaults: | |
run: | |
working-directory: ./backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install | |
deploy: | |
needs: test | |
defaults: | |
run: | |
working-directory: ./backend | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Glitch.com repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ secrets.BACKEND_GIT_URL }} | |
path: glitch-repo | |
- name: Initialize git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Fetch Changes from GitHub Repository | |
uses: actions/checkout@v4 | |
with: | |
path: github-repo | |
- name: Copy files from GitHub Repository to Glitch.com Repository | |
run: cp -r ${{ github.workspace }}/github-repo/* ${{ github.workspace }}/glitch-repo | |
- name: Commit changes | |
run: | | |
git add . | |
git commit -m "Github Actions: deploy to glitch.com" | |
- name: Deploy (git force push) to glitch.com # best way so far to deploy to glitch.com | |
run: git push ${{ secrets.BACKEND_GIT_URL }} |