v1.5.20 #457
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@v4 | |
- 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@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PAT }} | |
- name: Display contents of code directory | |
run: ls -la | |
- name: Display contents of .git directory | |
run: ls -la .git | |
- name: Create git copy | |
run: cp -r .git .git_copy | |
- name: Show git status | |
run: git status | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
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 }} |