Add GitHub actions configuration (#547)

Add GitHub actions configuration (#547)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..888a0ea
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,76 @@
+on:
+  push:
+    branches:
+      - master
+      - main
+  pull_request:
+  schedule:
+    - cron:  '0 0 * * *'
+
+jobs:
+  base:
+    runs-on: [ubuntu-20.04]
+    steps:
+      - name: Setup Docker
+        run: |
+          sudo bash -c 'echo "{ \"cgroup-parent\": \"/actions_job\",\"experimental\":true}" > /etc/docker/daemon.json'
+          sudo service docker restart
+          docker version -f '{{.Server.Experimental}}'
+      - uses: actions/checkout@master
+        with:
+          fetch-depth: 1
+      - name: build base image
+        run: |
+          cd image && ruby auto_build.rb base
+      - name: build test_build image
+        run: |
+          cd image && ruby auto_build.rb discourse_test_build
+      - name: run specs
+        run: |
+          docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build
+      - name: push to dockerhub
+        if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
+        env:
+          DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
+        run: |
+          TAG=`date +%Y%m%d-%H%M`
+          docker tag discourse/base:build discourse/base:2.0.$TAG
+          docker tag discourse/base:build discourse/base:release
+          docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
+          docker push discourse/base:release
+          docker push discourse/base:2.0.$TAG
+  test:
+    runs-on: [ubuntu-20.04]
+    needs: base
+    steps:
+      - uses: actions/checkout@master
+        with:
+          fetch-depth: 1
+      - name: build test_build image
+        run: |
+          cd image && ruby auto_build.rb discourse_test_public
+      - name: push to dockerhub
+        if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
+        env:
+          DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
+        run: |
+          docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
+          docker push discourse/discourse_test:release
+  dev:
+    runs-on: [ubuntu-20.04]
+    needs: base
+    steps:
+      - uses: actions/checkout@master
+        with:
+          fetch-depth: 1
+      - name: build test_build image
+        run: |
+          cd image && ruby auto_build.rb discourse_dev
+      - name: push to dockerhub
+        if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
+        env:
+          DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
+        run: |
+          docker tag discourse/discourse_dev:build discourse/discourse_dev:release
+          docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
+          docker push discourse/discourse_dev:release

GitHub sha: 9b12a42a2ec55bc449bdbcd2833b63b6612021fa

This commit appears in #547 which was approved by SamSaffron and Falco. It was merged by davidtaylorhq.