Update dependencies #1392
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update dependencies | |
on: | |
schedule: | |
- cron: '30 14,16,17,19 * * MON-FRI' | |
jobs: | |
update-dependencies: | |
name: Update dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '10.x' | |
- name: Update package dependencies | |
run: npm update --only=production | |
- name: Config Git user | |
run: | | |
git config --local user.email '[email protected]' | |
git config --local user.name 'GitHub Action' | |
- name: Check if template was updated | |
run: | | |
git diff package-lock.json | grep 'ecomplus/storefront-template' \ | |
&& echo "::set-output name=updated::1" \ | |
|| echo "::set-output name=updated::0" | |
id: check_template | |
- name: Commit files if changed | |
run: | | |
git add package-lock.json content | |
git diff-index --quiet HEAD || git commit -m '[skip ci] chore(deps): update pkg dependencies' | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: master | |
- name: Run build with new template | |
if: steps.check_template.outputs.updated == '1' | |
run: npm run build | |
- name: Deploy to branch dist | |
if: steps.check_template.outputs.updated == '1' | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: dist | |
FOLDER: dist |