Skip to content

Commit fe4c74c

Browse files
committed
Build image using GitHub Actions
1 parent 75bf6a3 commit fe4c74c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/main.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build Docker Image
2+
3+
on: [push, pull_request, release]
4+
5+
jobs:
6+
main:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Cache node modules
12+
uses: actions/cache@v2
13+
with:
14+
path: |
15+
~/.npm
16+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
17+
restore-keys: |
18+
${{ runner.os }}-node-
19+
20+
- name: Build Docker image
21+
run: |
22+
docker build -t cfreak/homepage-docs:latest .
23+
24+
- name: Before Deploy
25+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
26+
run: |
27+
docker logout
28+
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"
29+
30+
- name: Deploy master branch as latest
31+
if: github.ref == 'refs/heads/master'
32+
run: |
33+
docker push cfreak/homepage-docs:latest

0 commit comments

Comments
 (0)