When initializing github actions for firebase hosting i specified the following:
Set up the workflow to run a build script before every deploy? Yes What script should be run before every deploy? yarn run build.
This workflow gives me the error
Run yarn run build
yarn run v1.22.10
error Couldn't find a package.json file in "/home/runner/work/SpaceBar/SpaceBar"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.
I have a package.json file in my project directory. Why is it saying that it cannot find it?
firebase-hosting-merge.yml is in the directory called spacebar, which contains another directory called spacebar containing the package.json file. Is there anyway to cd into the sub directory in this file
name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn run build
- uses: FirebaseExtended/action-hosting-deploy@v0
As the actions/checkout
action gave you access to the repository files and directories, you can just cd
into the directory where the package.json
file is located before executing the yarn
command. Otherwise, it will only look for it at the repository root.
Example (for your second step)
run: |
cd spacebar/spacebar
yarn run build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With