Skip to content

Fix perm issue?

Fix perm issue? #6

Workflow file for this run

name: Deploy Project
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on: [push, pull_request]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- name: Install Vercel CLI
run: bun install --global vercel@latest
- name: Install SurrealDB CLI
run: |
curl -L https://install.surrealdb.com | sh
echo "$HOME/.surrealdb/bin" >> $GITHUB_PATH
- name: Pull Vercel Environment Information and Export Variables
run: |
if [ "${{ github.ref_name }}" == "main" ]; then
vercel pull --environment=production --yes --token ${{ secrets.VERCEL_TOKEN }}
target_file=".vercel/.env.production.local"
else
vercel pull --environment=preview --yes --token ${{ secrets.VERCEL_TOKEN }}
target_file=".vercel/.env.preview.local"
fi
# Export variables from the .env file without quotes
while IFS='=' read -r key value; do
# Ignore comments and empty lines
if [[ $key != "#"* ]] && [[ -n $key ]]; then
# Remove surrounding quotes from the value
value="${value%\"}"
value="${value#\"}"
# Skip the keys not used/needed by this action
if [[ $key != "PUBLIC_SURREAL_HOST" ]] &&
[[ $key != "AUTH_SECRET" ]] &&
[[ $key != "SURREAL_USER" ]] &&
[[ $key != "SURREAL_PASS" ]]; then
continue
fi
echo "::add-mask::$value"
echo "$key=$value" >> $GITHUB_ENV
fi
done < "$target_file"
# Set the namespace to the branch name
echo "PUBLIC_SURREAL_NAMESPACE=${{ github.ref_name }}" >> $GITHUB_ENV
# - name: Sync Queries to the Database
# run: |
# bun sync:queries
# - name: Install dependencies
# run: |
# bun i
# - name: Svelte Check
# run: |
# bun check
- name: Apply Database Schema and Define Authentication Token
run: |
surreal import \
--endpoint $PUBLIC_SURREAL_HOST \
-u $SURREAL_USER \
-p $SURREAL_PASS \
--ns $PUBLIC_SURREAL_NAMESPACE \
--db lumina \
database_schema.surql
# Define the token using echo to pipe the SQL command
echo "DEFINE TOKEN lumina_token ON SCOPE users TYPE HS256 VALUE '$AUTH_SECRET'" | \
surreal sql \
--endpoint $PUBLIC_SURREAL_HOST \
-u $SURREAL_USER \
-p $SURREAL_PASS \
--ns $PUBLIC_SURREAL_NAMESPACE \
--db lumina
- name: Deploy Project to Vercel
run: |
if [ "${{ github.ref_name }}" == "main" ]; then
vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} -b PUBLIC_SURREAL_NAMESPACE=$PUBLIC_SURREAL_NAMESPACE
else
vercel deploy --token=${{ secrets.VERCEL_TOKEN }} -b PUBLIC_SURREAL_NAMESPACE=$PUBLIC_SURREAL_NAMESPACE
fi