From b50818bce283f89d3c0dfde8c70fe5de46dc6c55 Mon Sep 17 00:00:00 2001 From: Jonathan Ling Date: Mon, 2 Aug 2021 11:26:34 -0400 Subject: [PATCH] Add github build and push action. --- .github/build-and-push.yml | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/build-and-push.yml diff --git a/.github/build-and-push.yml b/.github/build-and-push.yml new file mode 100644 index 0000000..2cd8316 --- /dev/null +++ b/.github/build-and-push.yml @@ -0,0 +1,50 @@ +name: ci + +on: + pull_request: + types: [closed] + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + colonelpopcorn/streaming-server + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + if: github.event.pull_request.merged == true + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event.pull_request.merged == true }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file