Merge pull request #24 from protofire/staging-harmony #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- 'production-harmony' | |
name: Docker build and push | |
env: | |
IMAGE_REGISTRY: ${{ secrets.PROD_OVH_REGISTRY_URL }} | |
IMAGE_REPOSITORY: blockscout/frontend | |
jobs: | |
push: | |
name: Docker build and push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Login to OVH Managed Private Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.PROD_OVH_REGISTRY_USERNAME }} | |
password: ${{ secrets.PROD_OVH_REGISTRY_PASSWORD }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
- name: Prepare image tag | |
shell: bash | |
run: | | |
echo "IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
- name: Build and push | |
run: | | |
docker build -t ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }} -t ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:latest --build-arg GIT_COMMIT_SHA=${{ env.IMAGE_TAG }} --build-arg GIT_TAG=${{ github.ref_type == 'tag' && github.ref_name || '' }} -f Dockerfile . | |
docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }} --all-tags |