From 7668b0b473beedb302d08fbe86ced3cc36d17de0 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 19 Mar 2020 16:19:07 -0500 Subject: [PATCH] Add CI with GitHub Actions to test and publish --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ .github/workflows/publish.yml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d62235f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI/CD + +on: + push: + schedule: + - cron: '1 0 * * *' + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Build Docker image + run: | + docker build . \ + --file simple/Dockerfile \ + --tag lukasheinrich/folding:$GITHUB_SHA \ + --compress + docker images diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8ec4a6d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish Docker Images + +on: + push: + branches: + - master + tags: + - v* + +jobs: + build-and-publish: + name: Build and publish Docker images to Docker Hub + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Build and Publish to Registry + if: "! ${{ startsWith(github.ref, 'refs/tags/') }}" + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: lukasheinrich/folding + dockerfile: simple/Dockerfile + tags: latest,simple + - name: Build and Publish to Registry with Release Tag + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: lukasheinrich/folding + dockerfile: simple/Dockerfile + tags: latest,latest-stable,simple + tag_with_ref: true