name: build dev on: push: branches-ignore: - master workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: ### extract branch name - name: Extract branch name if: github.event_name != 'pull_request' shell: bash run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV id: extract_branch - name: Extract branch name if: github.event_name == 'pull_request' run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: Use Node.js 16 uses: actions/setup-node@v1 with: node-version: 16 - run: npm install - run: npm run build env: CI: true ### Prepare docker & login to Dockerhub - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Cache Docker layers uses: actions/cache@v2 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} ### Set version - run: echo "VERSION=0.1.${{github.run_number}}" >> $GITHUB_ENV - run: echo "CONTAINER_TAG=fluencelabs/dashboard:${{ env.VERSION }}${{ env.BRANCH_NAME }}" >> $GITHUB_ENV ### Build and push docker image - name: Build and push id: docker_build uses: docker/build-push-action@v2 with: context: . file: ./caddy.Dockerfile push: true tags: ${{ env.CONTAINER_TAG }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }}