I'm trying to create a GitHub-Action that first uses Webpack to create a bundle.js file and then deploy my index.html and newly created bundle.js to Firebase hosting.
First I just pushed my bundle.js in my GitHub repository, but I since removed it via "git rm --cache public/bundle.js
" (not sure if this is the exact command) and added bundle.js to my .gitignore.
The action does work (no error or crash) but it seems that Firebase does not use the newly packaged bundle.js, but instead uses an old version that might be cached somewhere?
firebase-hosting-pull-request.yml:
name: Deploy to Firebase Hosting on PR
'on': pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PROJECTLIBRARIAN }}'
projectId: projectlibrarian
npm run build in this case executes webpack --mode=production
My index.js (which is webpack'd into bundle.js) only contains a single log statement which I changed to test the GitHub-Action.
Link to the Repo if it helps someone
I'm wondering if I need to clear some kind of GitHub actions cache? or maybe the Firebase deploy action script I'm using isn't doing what I think it should be doing? What confusing me the most is where does Firebase get the old version of bundle.js!
CodePudding user response:
Ok I have found two changes that fixed the problem.
Add channelId: live
in my workflow yaml
Reload the site with the "Empty chache and Hard reload" developer option.