From fe4c74cfcbb9be510de13bcbba28cd2f667daceb Mon Sep 17 00:00:00 2001 From: Henning Kasch Date: Tue, 24 Aug 2021 17:11:18 +0200 Subject: [PATCH] Build image using GitHub Actions --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..47700ba --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,33 @@ +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@v2 + 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