Skip to content

Create project copy #53

Create project copy

Create project copy #53

Workflow file for this run

name: Upload data to sanity project
on:
workflow_dispatch:
inputs:
sanity-project-id:
required: true
type: string
sanity-project-dataset:
required: true
type: string
vercel-project-name:
required: true
type: string
jobs:
upload-data:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_SANITY_PROJECT_ID: ${{ inputs.sanity-project-id }}
NEXT_PUBLIC_SANITY_DATASET: ${{ inputs.sanity-project-dataset }}
name: Upload data
steps:
- uses: actions/checkout@v4
# - name: Install dependencies
# run: npm install
# - name: Export dataset
# run: |
# SANITY_AUTH_TOKEN="${{ secrets.SANITY_AUTH_TOKEN }}" \
# npx sanity dataset import \
# prod-copy.tar.gz production
- name: Curl to add vercel deploy hook to sanity
run: |
curl -X POST "https://api.sanity.io/v2021-10-04/hooks/projects/${{ inputs.sanity-project-id }}" \
-H "Authorization: Bearer ${{ secrets.SANITY_AUTH_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
{
"type":"document",
"name":"Sanity Studio",
"url": "https://${{ inputs.vercel-project-name }}.vercel.app/api/sanity-deploy",
"httpMethod":"POST",
"apiVersion":"v2021-03-25",
"includeDrafts":false,
"dataset":"*",
"rule": {
"on": ["create", "update", "delete"],
},
"headers": {
"Authorization": "Bearer ${{ secrets.VERCEL_PERSONAL_AUTH_TOKEN }}",
},
}'
# - name: curl
# uses: enflo/curl-action@master
# with:
# curl: ${{ CURL ARGUMENTS }}
# # correct CLI command (env sanity project should be with empty dataset):
# # sanity dataset import prod-copy.tar.gz production
# args: . dataset import prod-copy.tar.gz production
# - name: Add sanity webhook
# run: ls
# working code
# run: |
# SANITY_AUTH_TOKEN="${{ secrets.SANITY_AUTH_TOKEN }}" \
# npx sanity dataset import \
# prod-copy.tar.gz production