diff --git a/tutorials/lifetime_faq.md b/tutorials/lifetime_faq.md index ed86afbb..0324b519 100644 --- a/tutorials/lifetime_faq.md +++ b/tutorials/lifetime_faq.md @@ -46,89 +46,115 @@ Below you'll find some instructions on how to: - set up auto-updates - manually update your repo (requires auto-update to be setup) -### Setting up auto update -To set up your instance for auto-updates, you can follow these instructions: +# Vercel Lifetime: Keeping Your Deployment Up-to-Date -https://www.loom.com/share/528ff69dedf64b43a57492bcba2ca6c2 - -```name: Sync /web Directory from Upstream Repository - -on: - schedule: - - cron: '0 0 * * *' # Runs daily at midnight UTC - workflow_dispatch: # Allows manual triggering - -permissions: - contents: write - -jobs: - sync_web_directory: - runs-on: ubuntu-latest - - steps: - # Step 1: Checkout your repository - - name: Checkout Your Repository - uses: actions/checkout@v3 - with: - ref: main - fetch-depth: 0 - token: ${{ secrets.PAT3 }} # Use PAT with appropriate permissions - - # Step 2: Configure Git (Set author identity globally) - - name: Configure Git - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - # Step 3: Remove Existing Files Except .git and .github - - name: Remove Existing Files - run: | - find . -mindepth 1 -maxdepth 1 \ - ! -name '.git' \ - ! -name '.github' \ - -exec rm -rf {} + - - # Step 4: Checkout /web Directory from Upstream - - name: Checkout /web Directory from Upstream - uses: actions/checkout@v3 - with: - repository: different-ai/file-organizer-2000 - ref: master - path: upstream_repo - # Uses default GITHUB_TOKEN for read access - - # Step 5: Copy /web Contents to Root - - name: Copy /web Contents to Root - run: | - cp -r upstream_repo/web/* . - - # Step 6: Remove upstream_repo Directory - - name: Remove Upstream Repo Directory - run: rm -rf upstream_repo - - # Step 7: Commit and Push Changes - - name: Commit and Push Changes - run: | - git add . - git commit -m "Update repository with latest /web content from upstream" - git push origin main -``` - ---- +If you've chosen Vercel as your deployment system, it's important to ensure that your server code remains up-to-date with the latest changes. Below, you'll find instructions on how to set up automatic updates and manually update your repository. -## Manually triggering updates - -If you setup auto-updates via our instructions above you can go to actions, look for the worfklow, and click on run workflow. +## Video walkthrough +https://www.loom.com/share/528ff69dedf64b43a57492bcba2ca6c2 -And run the update action manually. If you don't we trigger updates every 24h. -This might be useful if we just shipped a fix and you want to be up to date. +## Setting Up Auto-Updates + +To automate updates for your Vercel instance, follow these steps: + +1. **Access GitHub Actions**: + - Navigate to your project on GitHub. + - Click on the "Actions" tab. + - Select "Set up a workflow yourself." + +2. **Create a Workflow File**: + - Copy the following YAML configuration into your workflow file: + + ```yaml + on: + schedule: + - cron: '0 0 * * *' # Runs daily at midnight UTC + workflow_dispatch: # Allows manual triggering + + permissions: + contents: write + + jobs: + sync_web_directory: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout your repository + - name: Checkout Your Repository + uses: actions/checkout@v3 + with: + ref: main + fetch-depth: 0 + token: ${{ secrets.PAT3 }} # Use PAT with appropriate permissions + + # Step 2: Configure Git (Set author identity globally) + - name: Configure Git + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + # Step 3: Remove Existing Files Except .git and .github + - name: Remove Existing Files + run: | + find . -mindepth 1 -maxdepth 1 \ + ! -name '.git' \ + ! -name '.github' \ + -exec rm -rf {} + + + # Step 4: Checkout /web Directory from Upstream + - name: Checkout /web Directory from Upstream + uses: actions/checkout@v3 + with: + repository: different-ai/file-organizer-2000 + ref: master + path: upstream_repo + + # Step 5: Copy /web Contents to Root + - name: Copy /web Contents to Root + run: | + cp -r upstream_repo/web/* . + + # Step 6: Remove upstream_repo Directory + - name: Remove Upstream Repo Directory + run: rm -rf upstream_repo + + # Step 7: Commit and Push Changes + - name: Commit and Push Changes + run: | + git add . + git commit -m "Update repository with latest /web content from upstream" + git push origin main + ``` + +3. **Set Up Personal Access Token (PAT)**: + - Go to your GitHub settings. + - Navigate to "Developer settings" and create a new "Personal Access Token" with the necessary permissions. + - Add this token as a secret in your GitHub repository settings under "Secrets and variables" with the name `PAT3`. + +4. **Commit and Activate**: + - Commit the workflow file to your repository. + - The workflow will now automatically run daily at midnight UTC, updating your deployment. + +## Manually Triggering Updates + +If you need to update your deployment manually (for instance, after a recent fix), you can do so by: + +1. Navigating to the "Actions" tab in your GitHub repository. +2. Locating the workflow you set up. +3. Clicking on "Run workflow" to trigger the update manually. + +This manual trigger is useful if you want to ensure your deployment is immediately up-to-date with the latest changes. Screenshot 2024-11-17 at 09 51 25 +## Checking if it works +Open up vercel and check if there was a new deployment for your project (or if it might still be building): +Screenshot 2024-11-17 at 09 58 31 +