I want to deploy Flutter Web to my firebase hosting, so far i have no issue, however when i introduce a package that requires token it wont work and throws error on step "- uses: FirebaseExtended/action-hosting-deploy@v0"
Let's say my project name is example_web and the package that requires github token is example_package
My Flutter example_web/pubspec.yaml
#the third party package that requires the token
example_package:
git:
url: https://github.com/example/example.git
ref: main
Where the example_package requires github personal access token
and my github action is firebase-hosting-merge.yml (note this works perfectly if im not using the example_package in my project and the app is successfully deployed to firebase hosting)
name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- release
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.5'
channel: 'stable'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_EXAMPLE_WEBSITE }}'
channelId: live
projectId: example-web-project-id
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
Now i introduced a secret into the example_web repository and put the personal access token and named it EXAMPLE_PACKAGE_TOKEN
Now, what part do i need to adjust in my firebase-hosting-merge.yml or pubspec.yaml if any.
I tried adjusting
pubspec.yaml
example_package:
git:
url: https://{EXAMPLE_PACKAGE_TOKEN}@github.com/example/example.git
ref: main
and the firebase-hosting-merge.yml I added this part after the actions/checkout@v3
#rest of the code
steps:
- uses: actions/checkout@v3
- name: Replace placeholder with actual value
run: |
sed -i "s|{EXAMPLE_PACKAGE_TOKEN}|${{ secrets.EXAMPLE_PACKAGE_TOKEN}}|g" pubspec.yaml
- uses: subosito/flutter-action@v2
#rest of the code
But didn't work