Skip to content

Commit

Permalink
feat: yarn caching and publish to github
Browse files Browse the repository at this point in the history
  • Loading branch information
benw-apposing committed Oct 30, 2020
1 parent f980fef commit 2324cf5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: 'Build'

on: push

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,20 +11,27 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
# yarn cache files are stored in `~/.cache/yarn` on Linux/macOS
path: ~/.cache/yarn
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile

- name: Run tests
run: yarn test
19 changes: 19 additions & 0 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: my-org/my-repo/my-image
tag_with_ref: true

0 comments on commit 2324cf5

Please sign in to comment.