Update actions/cache action to v4 #50
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: Build Docker Image | |
on: [push, pull_request, release] | |
jobs: | |
main: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Build Docker image | |
run: | | |
docker build -t cfreak/homepage-docs:latest . | |
- name: Before Deploy | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
run: | | |
docker logout | |
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" | |
- name: Deploy master branch as latest | |
if: github.ref == 'refs/heads/master' | |
run: | | |
docker push cfreak/homepage-docs:latest |