Merge pull request #14 from CIROH-UA/fixing-deployment #62
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
name: build_push_dev_image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '*' | |
paths: | |
- 'apps/**' | |
- 'salt/**' | |
- 'extensions/**' | |
- 'config/**' | |
- 'Dockerfile' | |
- 'requirements/**' | |
env: | |
DOCKER_HUB_ORG: awiciroh | |
DOCKER_REPO: tethysapp-ciroh-portal | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
clean-space: | |
uses: CIROH-UA/tethysportal-ciroh/.github/workflows/clean_space.yml@main | |
build: | |
needs: [clean-space] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'false' | |
- name: Set up Git credentials for GitLab submodule | |
run: | | |
git config --global url."https://oauth2:${GITLAB_PAT}@git.aquaveo.com/".insteadOf "https://git.aquaveo.com/" | |
env: | |
GITLAB_PAT: ${{ secrets.GITLAB_PAT }} | |
# Step 4: Update submodules recursively | |
- name: Update submodules recursively | |
run: | | |
git submodule sync --recursive | |
git submodule update --init --recursive | |
# Checks-out the hydrocompute extra submodule | |
- name: checkout Hydrocompute submodule | |
run: | | |
cd apps/tethysapp-hydrocompute/tethysapp/hydrocompute/public/HydroCompute && git submodule update --force --init --recursive --remote | |
- name: Set Tag | |
run: | | |
echo "TAG=dev_${GITHUB_SHA}" >> $GITHUB_ENV | |
echo "TAG_LATEST=dev_latest" >> $GITHUB_ENV | |
- name: Test Tag | |
run: | | |
echo $TAG | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_BUILDER_USERNAME }} | |
password: ${{ secrets.DOCKER_BUILDER_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ env.DOCKER_HUB_ORG }}/${{ env.DOCKER_REPO }}:${{ env.TAG }} | |
${{ env.DOCKER_HUB_ORG }}/${{ env.DOCKER_REPO }}:${{ env.TAG_LATEST }} | |
cache-from: type=registry,ref=${{ env.DOCKER_HUB_ORG }}/${{ env.DOCKER_REPO }}-dev-cache:latest | |
cache-to: type=registry,ref=${{ env.DOCKER_HUB_ORG }}/${{ env.DOCKER_REPO }}-dev-cache:latest,mode=max | |
cleanup: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: only keeps the first 5 image | |
run: | | |
echo "TAG=dev_${GITHUB_SHA}" >> $GITHUB_ENV | |
echo $TAG | |
. .github/scripts/clean_up_docker_hub.sh '${{ secrets.DOCKER_BUILDER_USERNAME }}' '${{ secrets.DOCKER_BUILDER_TOKEN }}' '${{ env.DOCKER_HUB_ORG }}' '${{ env.DOCKER_REPO }}' '${{ env.MAX_NUMBER_IMAGE }}' | |
deploy-with_dry-run: | |
needs: [build] | |
uses: CIROH-UA/tethysportal-ciroh/.github/workflows/helm_deploy.yml@main | |
with: | |
dry-run: true | |
secrets: inherit |