Closed adinvadim closed 4 months ago
@kevlened need your help
+1 I would like to know how to use this on firebase too. Thanks in advance!
@yliu7810 @adinvadim, I've managed to do this by creating the following workflow:
name: Migrate Firestore
on:
push:
branches:
- your_branch
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Install Dependencies
run: npm install
- id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.YOUR_GCLOUD_SERVICE_ACCOUNT_JSON_ENCODED_TO_BASE64 }}
- name: Migrate data
run: npm run migrations # this basically runs fireway migrate
I have not found the specifics roles that have to enabled for a service account for this to work, so that I've simply used basic role Editor
I am having trouble with the library when using google-github-actions/auth. Whenever I use the new workload identity federation for Google auth, I get an error with "Invalid content in credentials file" .. If I use the deprecated service account method, it works fine.
Did anyone face this issue? @eugeneford
@omarsourour I have encountered the same issue. Did you come upon a solution?
@anettebgo I didn't unfortunately.. Honestly I didn't try too much.
I solved my problem like this
- name: Prepare Service Account for Migrations
run: |
touch service-account.json
printf "%s\n" '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' >> service-account.json
...
- name: Migrations
run: |
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/service-account.json"
cd functions && \
npx fireway migrate \
--require='ts-node/register' \
--path='./src/migrations' \
--projectId=${{ secrets.PROJECT_ID }}
I got firebase token by using command
firebase login:ci
, and after deploy with flag--token
How to run migrations with this token?