Docker images in workflows development & production #2
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
# This workflow deploy system tools to production environment | ||
name: deploy PRODUCTION | ||
on: | ||
pull_request_review: | ||
types: | ||
- submitted | ||
jobs: | ||
build-package-on-pull-request: | ||
if: ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && github.event.pull_request.head.ref == 'develop' && github.event.pull_request.base.ref == 'master' }} | ||
name: Build package ${{ vars.MN_MANAGER_PACKAGE_NAME }} | ||
uses: WattRex/System-Tools/.github/workflows/build_python_package.yml@develop | ||
with: | ||
package-name: ${{ vars.MN_MANAGER_PACKAGE_NAME }} | ||
package-path: mn_manager | ||
source-path: mn_manager/src/wattrex_mn_manager | ||
python-version: "3.10" | ||
is-test-package: false | ||
publish-package: | ||
name: Publish package ${{ vars.MN_MANAGER_PACKAGE_NAME }} to PyPi | ||
needs: build-package-on-pull-request | ||
runs-on: ubuntu-latest | ||
environment: production | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download a single artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ vars.MN_MANAGER_PACKAGE_NAME }} | ||
path: ${{ vars.MN_MANAGER_PACKAGE_NAME }}/dist/ | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 | ||
with: | ||
verbose: true | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: "${{ vars.MN_MANAGER_PACKAGE_NAME }}/dist/" | ||
publish-docker-image-mn-manager: | ||
name: Publish mn-manager docker image | ||
needs: publish-package | ||
uses: ./.github/workflow/docker_image.yml | ||
with: | ||
dockerfile-path: ./devops/mn_manager/Dockerfile.mn_manager | ||
docker-repo-name: wattrex-mn-manager | ||
is-develop: false | ||
publish-docker-image-web-server: | ||
name: Publish web-server docker image | ||
needs: publish-package | ||
uses: ./.github/workflow/docker_image.yml | ||
with: | ||
dockerfile-path: ./devops/web_server/Dockerfile.web_server | ||
docker-repo-name: wattrex-web-server | ||
is-develop: false |