Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache to node workflows #5924

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
- master

paths-ignore:
- 'website/**'
- "website/**"

pull_request:
types: [opened, synchronize, reopened]

paths-ignore:
- 'website/**'
- "website/**"

jobs:
build:
Expand All @@ -25,8 +25,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '*'
node-version: "*"
check-latest: true
cache: yarn
- name: log versions
run: node --version && npm --version && yarn --version
- name: install dependecies
Expand Down Expand Up @@ -59,17 +60,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '*'
node-version: "*"
check-latest: true
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn
- uses: actions/download-artifact@master
with:
name: dev-test-website-${{ runner.os }}
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Netlify CMS Publish

on:
repository_dispatch:

repository_dispatch: null
jobs:
check-permission:
runs-on: ubuntu-latest
env:
SENDER: ${{ github.event.sender.login }}
ALLOWED_LOGINS_TO_PUBLISH: ${{ secrets.ALLOWED_LOGINS_TO_PUBLISH }}
steps:
- name: 'Check Permission To Publish'
- name: "Check Permission To Publish"
run: |
if [[ "$SENDER" =~ ^$ALLOWED_LOGINS_TO_PUBLISH$ ]]; then
echo "$SENDER is allowed to publish"
Expand All @@ -29,14 +28,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '*'
node-version: "*"
check-latest: true
- uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn
- name: update yarn to latest version
run: |
sudo apt update && sudo apt install yarn
Expand All @@ -59,7 +53,7 @@ jobs:
SLACK_TOKEN: ${{secrets.SLACK_TOKEN}}
CHANNEL_ID: ${{secrets.CHANNEL_ID}}
PUBLISH_COMMAND: "yarn\npublish:ci"
CODE_PATTERN: 'Enter OTP'
CODE_PATTERN: "Enter OTP"
# 40 minutes for the entire command, 20 minutes for waiting for 2FA
TIMEOUT: '2400000'
REVERT_COMMAND: './scripts/revert_publish.sh'
TIMEOUT: "2400000"
REVERT_COMMAND: "./scripts/revert_publish.sh"