Aug 20, 2023
0
Level 1
Avoid running Github Action multiple times on releases
Hi! As the title says, I have a GitHub action that runs on releases to auto deploy a Vue app to Firebase, but when there is a release (or prerelease) the action runs 3 times.
This is the GH-Action that we are using.
name: Firebase Deploy
on:
release:
type: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: 16
- name: "Create env file for Testing"
if: "github.event.release.prerelease"
run: |
echo "${{ secrets.ENV_FILE_TEST }}" > .env
- name: "Create env file for Production"
if: "!github.event.release.prerelease"
run: |
echo "${{ secrets.ENV_FILE_PRODUCTION }}" > .env
- name: "Installing dependencies"
run: npm ci
- name: "Building app"
run: npm run build
- name: "Deploying to Firebase"
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
The base idea is to run this action every time we do a release or prerelease. But as I said before it runs 3 times.
Also I didnt know on what channel publish this so I'm using General.
Thanks!
Please or to participate in this conversation.