From f85c246fc52e6a78dce1147474934439ce14ea7a Mon Sep 17 00:00:00 2001 From: Gareth Latty Date: Sun, 11 Oct 2020 17:26:24 +0100 Subject: [PATCH] Move to GitHub Actions for build. --- .github/workflows/build.yaml | 69 ++++++++++++++++++++++++++++++++++++ README.md | 4 +-- 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e83b4bf --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,69 @@ +name: Build + +on: + push: + branches: + - master + tags: + - v*.*.* + +env: + COMMIT_VERSION: "${{ github.sha }}-dev" + +jobs: + build: + name: Build docker images. + runs-on: ubuntu-latest + strategy: + matrix: + component: ["server", "client"] + env: + COMPONENT: ${{ matrix.component }} + steps: + - name: Checkout repository. + uses: actions/checkout@v2 + - name: Get version from tag. + uses: olegtarasov/get-tag@v1 + continue-on-error: true + - name: Build image. + run: + cd "${COMPONENT}" && + docker build -t "massivedecks/manydecks-${COMPONENT}:${COMMIT_VERSION}" + --build-arg VCS_REF="${GITHUB_SHA}" + --build-arg BUILD_DATE="$(date --rfc-3339=seconds)" + --build-arg VERSION="${GITHUB_TAG_NAME:-${COMMIT_VERSION}}" + . + - name: Save image. + run: docker save "massivedecks/manydecks-${COMPONENT}:${COMMIT_VERSION}" | gzip > "image.tar.gz" + - name: Store image for publish job. + uses: actions/upload-artifact@v1 + with: + name: ${{ matrix.component }} + path: image.tar.gz + + publish: + name: Publish docker images. + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + COMPONENT: ["server", "client"] + env: + COMPONENT: ${{ matrix.component }} + steps: + - name: Retrieve image from build job. + uses: actions/download-artifact@v1 + with: + name: ${{ matrix.component }} + - name: Load image. + run: docker load < "${COMPONENT}/image.tar.gz" + - name: Get version from tag. + uses: olegtarasov/get-tag@v1 + - name: Publish image. + uses: lattyware/push-docker-image-to-version-tags@v1 + with: + image: "massivedecks/manydecks-${{ matrix.component }}" + tag: ${{ env.COMMIT_VERSION }} + version: ${{ env.GITHUB_TAG_NAME }} + user: "latty" + token: ${{ secrets.DOCKER_HUB_TOKEN }} diff --git a/README.md b/README.md index 36d53dd..ef028e7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # [Many Decks][hosted] [![Current Release Version](https://img.shields.io/github/v/tag/Lattyware/manydecks?label=release&sort=semver)](https://github.com/Lattyware/manydecks/releases) -[![Client Docker Build](https://img.shields.io/docker/cloud/build/massivedecks/manydecks-client?label=client%20docker%20build)][docker-client] -[![Server Docker Build](https://img.shields.io/docker/cloud/build/massivedecks/manydecks-server?label=server%20docker%20build)][docker-server] +[![Build Status](https://img.shields.io/github/workflow/status/Lattyware/manydecks/Build)](https://github.com/Lattyware/manydecks/actions) [![License](https://img.shields.io/github/license/Lattyware/manydecks)](LICENSE) +[![Follow on Twitter for Status & Updates](https://img.shields.io/twitter/follow/Massive_Decks?label=Status%20%26%20Updates&style=social)](https://twitter.com/Massive_Decks) Many Decks is a free, open source deck source that can be used to host decks for [Massive Decks][md], a comedy party game based on Cards against Humanity.