[pre-commit.ci] pre-commit autoupdate #43
Workflow file for this run
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
# yamllint disable rule:line-length | |
name: Docker Build and Push | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get version from script | |
id: get_version | |
working-directory: feder | |
run: | | |
echo "version=$(python version.py)" >> $GITHUB_ENV | |
- name: Get deployment env | |
id: get_deployment | |
run: | | |
if [[ $GITHUB_REF == *"master"* ]]; then | |
DEPLOYMENT="prod" | |
elif [[ $GITHUB_REF == *"develop"* ]]; then | |
DEPLOYMENT="staging" | |
fi | |
echo "deployment=$DEPLOYMENT" >> $GITHUB_ENV | |
env | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PAT }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: .contrib/docker/Dockerfile.web.production | |
push: true | |
tags: | | |
${{ secrets.DOCKER_USERNAME }}/${{ vars.REPO_NAME }}:latest-${{ env.deployment }} | |
${{ secrets.DOCKER_USERNAME }}/${{ vars.REPO_NAME }}:${{ env.version }}-${{ env.deployment }} |