diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml new file mode 100644 index 00000000..7c4dc2d5 --- /dev/null +++ b/.github/workflows/docker_publish.yml @@ -0,0 +1,45 @@ +on: + push: + tags: + - '.*' + workflow_run: + workflows: ["Test code"] + branches: [master, develop] + types: + - completed + +name: Docker Build +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check Out Repo + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Extract tag name + id: extract_tag_name + shell: bash + run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})" + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile + push: true + tags: napalmautomation/napalm-logs:${{ steps.extract_tag_name.outputs.tag }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }}