From 5c65f1a0b2302f926c2788b1ff6f42ea424ade0e Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Fri, 13 Dec 2019 20:23:43 +0700 Subject: [PATCH] Add ci Action --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cff9093 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: Docker CI +on: push +env: + DOCKER_BUILDKIT: 1 +jobs: + build: + name: Build + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + - name: Build dockerpi:vm + run: docker build -t lukechilds/dockerpi:vm --target dockerpi-vm . + - name: Build dockerpi + run: docker build -t lukechilds/dockerpi:latest --target dockerpi . + - name: Log image data + run: docker images lukechilds/dockerpi + - name: Save image tarballs + run: | + mkdir -p images && + images=$(docker images lukechilds/dockerpi --format "{{.Repository}}:{{.Tag}}") + for image in $images; do docker save $image | gzip > "images/$(echo $image | tr '/' '-').tgz" + - name: Print sha256sum of built image + run: sha256sum images/* + - name: Upload image tarballs + uses: actions/upload-artifact@v1.0.0 + with: + name: images + path: images/ + publish: + name: Publish + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-18.04 + needs: build + steps: + - name: Download image tarballs + uses: actions/download-artifact@v1.0.0 + with: + name: images + - name: Print sha256sum of all images + run: sha256sum images/* + - name: Load image tarballs + run: for image in images/*; do docker load -i $image; done + - name: Log image data + run: docker images lukechilds/dockerpi + - name: Login to Docker Hub + run: echo "${{secrets.DOCKER_TOKEN}}" | docker login -u=lukechilds --password-stdin + - name: Push to Docker Hub + run: docker push lukechilds/dockerpi