mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Add if statement to website build workflow. (#95)
Should skip over website build workflow if the changes being pushed aren't to the master branch in the fleetdm/fleet repo.
This commit is contained in:
parent
b73cab2320
commit
149b4eda42
1 changed files with 53 additions and 51 deletions
104
.github/workflows/deploy-fleet-website.yml
vendored
104
.github/workflows/deploy-fleet-website.yml
vendored
|
|
@ -7,65 +7,67 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
if: (GITHUB_REPOSITORY == 'fleetdm/fleet')
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Configure our access credentials for the Heroku CLI
|
||||
- uses: akhileshns/heroku-deploy@v3.6.8
|
||||
with:
|
||||
heroku_api_key: ${{secrets.HEROKU_API_TOKEN_FOR_BOT_USER}}
|
||||
heroku_app_name: "" # this has to be blank or it doesn't work
|
||||
heroku_email: ${{secrets.HEROKU_EMAIL_FOR_BOT_USER}}
|
||||
justlogin: true
|
||||
- run: heroku auth:whoami
|
||||
# Configure our access credentials for the Heroku CLI
|
||||
- uses: akhileshns/heroku-deploy@v3.6.8
|
||||
with:
|
||||
heroku_api_key: ${{secrets.HEROKU_API_TOKEN_FOR_BOT_USER}}
|
||||
heroku_app_name: "" # this has to be blank or it doesn't work
|
||||
heroku_email: ${{secrets.HEROKU_EMAIL_FOR_BOT_USER}}
|
||||
justlogin: true
|
||||
- run: heroku auth:whoami
|
||||
|
||||
# Set the Node.js version
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
# Set the Node.js version
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
# Now start building!
|
||||
# > …but first, get a little crazy for a sec and delete the top-level package.json file
|
||||
# > i.e. the one used by the Fleet server. This is because require() in node will go
|
||||
# > hunting in ancestral directories for missing dependencies, and since some of the
|
||||
# > bundled transpiler tasks sniff for package availability using require(), this trips
|
||||
# > up when it encounters another Node universe in the parent directory.
|
||||
- run: rm -rf package.json package-lock.json node_modules/
|
||||
# > Turns out there's a similar issue with how eslint plugins are looked up, so we
|
||||
# > delete the top level .eslintrc file too.
|
||||
- run: rm -f .eslintrc.js
|
||||
# Now start building!
|
||||
# > …but first, get a little crazy for a sec and delete the top-level package.json file
|
||||
# > i.e. the one used by the Fleet server. This is because require() in node will go
|
||||
# > hunting in ancestral directories for missing dependencies, and since some of the
|
||||
# > bundled transpiler tasks sniff for package availability using require(), this trips
|
||||
# > up when it encounters another Node universe in the parent directory.
|
||||
- run: rm -rf package.json package-lock.json node_modules/
|
||||
# > Turns out there's a similar issue with how eslint plugins are looked up, so we
|
||||
# > delete the top level .eslintrc file too.
|
||||
- run: rm -f .eslintrc.js
|
||||
|
||||
# Get dependencies (including dev deps)
|
||||
- run: cd website/ && npm install
|
||||
# Get dependencies (including dev deps)
|
||||
- run: cd website/ && npm install
|
||||
|
||||
# Run sanity checks
|
||||
- run: cd website/ && npm test
|
||||
# Run sanity checks
|
||||
- run: cd website/ && npm test
|
||||
|
||||
# Compile assets
|
||||
- run: cd website/ && npm run build-for-prod
|
||||
# Compile assets
|
||||
- run: cd website/ && npm run build-for-prod
|
||||
|
||||
# Commit newly-built assets locally so we can push them to Heroku below.
|
||||
# (This commit will never be pushed to GitHub- only to Heroku.)
|
||||
# > The local config flags make this work in GitHub's environment.
|
||||
- run: git add website/.www
|
||||
- run: git -c "user.name=Fleetwood" -c "user.email=github@example.com" commit -am 'AUTOMATED COMMIT - Deployed the latest, including modified HTML layouts and .sailsrc file that reference minified assets.'
|
||||
# Commit newly-built assets locally so we can push them to Heroku below.
|
||||
# (This commit will never be pushed to GitHub- only to Heroku.)
|
||||
# > The local config flags make this work in GitHub's environment.
|
||||
- run: git add website/.www
|
||||
- run: git -c "user.name=Fleetwood" -c "user.email=github@example.com" commit -am 'AUTOMATED COMMIT - Deployed the latest, including modified HTML layouts and .sailsrc file that reference minified assets.'
|
||||
|
||||
# Configure the Heroku app we'll be deploying to
|
||||
- run: heroku git:remote -a production-fleetdm-website
|
||||
- run: git remote -v
|
||||
# Configure the Heroku app we'll be deploying to
|
||||
- run: heroku git:remote -a production-fleetdm-website
|
||||
- run: git remote -v
|
||||
|
||||
# Deploy to Heroku (by pushing)
|
||||
# > Since a shallow clone was grabbed, we have to "unshallow" it before forcepushing.
|
||||
- run: echo "Unshallowing local repository…"
|
||||
- run: git fetch --prune --unshallow
|
||||
- run: echo "Deploying branch '${GITHUB_REF##*/}' to Heroku…"
|
||||
- run: git push heroku +${GITHUB_REF##*/}:master
|
||||
- name: 🌐 https://fleetdm.com
|
||||
run: echo '' && echo '--' && echo 'OK, done. It should be live momentarily.' && echo '(if you get impatient, check the Heroku dashboard for status)' && echo && echo ' 🌐–• https://fleetdm.com'
|
||||
# Deploy to Heroku (by pushing)
|
||||
# > Since a shallow clone was grabbed, we have to "unshallow" it before forcepushing.
|
||||
- run: echo "Unshallowing local repository…"
|
||||
- run: git fetch --prune --unshallow
|
||||
- run: echo "Deploying branch '${GITHUB_REF##*/}' to Heroku…"
|
||||
- run: git push heroku +${GITHUB_REF##*/}:master
|
||||
- name: 🌐 https://fleetdm.com
|
||||
run: echo '' && echo '--' && echo 'OK, done. It should be live momentarily.' && echo '(if you get impatient, check the Heroku dashboard for status)' && echo && echo ' 🌐–• https://fleetdm.com'
|
||||
|
|
|
|||
Loading…
Reference in a new issue