name: Docker image on: push: # Publish `next` as Docker `latest` image. branches: - next # Publish `v1.2.3` tags as releases. tags: - v* env: IMAGE_NAME: sdb BUILD: "false" jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 2 - name: Setup environment run: | chmod +x ci/buildvars.sh ci/buildvars.sh - uses: actions-rs/toolchain@v1 with: toolchain: stable - name: build uses: actions-rs/cargo@v1 with: command: build args: --release - name: Build image run: docker build . --file Dockerfile --tag $IMAGE_NAME if: env.BUILD == 'true' || github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') - name: Push to Docker Hub uses: docker/build-push-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: skytable/sdb tags: latest tag_with_ref: true if: env.BUILD == 'true' || github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')