|
| 1 | +name: SPDK Docker Image BUILD |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@master |
| 13 | + |
| 14 | + - name: Set docker image tag |
| 15 | + id: get_info |
| 16 | + run: | |
| 17 | + if [[ "${{github.ref}}" == refs/pull/* ]]; then |
| 18 | + tag=${GITHUB_REF/\/merge/} |
| 19 | + echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV |
| 20 | + else |
| 21 | + echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV |
| 22 | + fi |
| 23 | + echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV |
| 24 | + echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV |
| 25 | +
|
| 26 | + - name: Build the docker image |
| 27 | + run: docker build --file docker/Dockerfile_spdk --tag simplyblock/spdk-core:$TAG . |
| 28 | + |
| 29 | + - name: Login to Docker Hub |
| 30 | + uses: docker/login-action@v1 |
| 31 | + with: |
| 32 | + username: hamdysimplyblock |
| 33 | + password: ${{ secrets.DOCKER_PASS }} |
| 34 | + |
| 35 | + - name: Push Images |
| 36 | + run: docker push simplyblock/spdk-core:$TAG |
| 37 | + |
| 38 | + - name: Configure AWS Credentials |
| 39 | + uses: aws-actions/configure-aws-credentials@v1 |
| 40 | + with: |
| 41 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_HAMDI }} |
| 42 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_HAMDI }} |
| 43 | + aws-region: us-east-1 |
| 44 | + |
| 45 | + - name: Login to ECR |
| 46 | + id: login-ecr |
| 47 | + uses: aws-actions/amazon-ecr-login@v2 |
| 48 | + |
| 49 | + - name: Tag docker image |
| 50 | + run: docker tag simplyblock/spdk-core:$TAG 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$TAG |
| 51 | + |
| 52 | + - name: Push the docker image |
| 53 | + run: docker image push 565979732541.dkr.ecr.us-east-1.amazonaws.com/spdk-core:$TAG |
0 commit comments