Release v2 #9
This file contains hidden or 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: "Release v2" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment' | |
| required: true | |
| default: 'dev' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Build and Push | |
| environment: "dev" | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| # - name: Generate release notes | |
| # run: | |
| # ./gen-rel-notes.sh > CHANGELOG | |
| - name: Set commit SHA as code version | |
| run: echo "CODE_VERSION=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ vars.WS_DOCKER_REGISTRY }} | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build frontend | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./frontend | |
| push: true | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-frontend:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-frontend:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build osm-cgimap | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./osm-cgimap | |
| push: true | |
| file: ./osm-cgimap/docker/ubuntu/Dockerfile2404 | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-cgimap:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-cgimap:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build osm-log-proxy | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./osm-log-proxy | |
| push: true | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-log-proxy:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-log-proxy:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build osm-rails | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./osm-rails | |
| push: true | |
| file: ./osm-rails/Dockerfile.prod | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-rails:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-rails:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build osm-web | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./osm-web | |
| push: true | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-web:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-osm-web:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build pathways-editor | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./pathways-editor | |
| push: true | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-pathways-editor:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-pathways-editor:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build rapid | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./rapid | |
| push: true | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-rapid:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-rapid:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build tasks-backend | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./tasking-manager | |
| push: true | |
| file: ./tasking-manager/scripts/docker/Dockerfile.backend | |
| target: prod | |
| build-args: | | |
| APP_UID=1000 | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-tasks-backend:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-tasks-backend:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build tasks-frontend | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./tasking-manager | |
| push: true | |
| file: ./tasking-manager/scripts/docker/Dockerfile.frontend | |
| build-args: | | |
| TM_APP_API_URL="https://tasks.workspaces-${{ vars.ENV }}.sidewalks.washington.edu/" | |
| tags: ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-tasks-frontend:${{ vars.ENV }}, ${{ vars.WS_DOCKER_REGISTRY }}/workspaces-tasks-frontend:${{ env.CODE_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: Deploy | |
| environment: "dev" | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Deploy | |
| env: | |
| ENV: ${{ vars.ENV }} | |
| WS_DOCKER_REGISTRY: ${{ vars.WS_DOCKER_REGISTRY }} | |
| # machine to deploy to | |
| AZURE_DOCKER_HOST_IP: ${{ vars.AZURE_DOCKER_HOST_IP }} | |
| # tag to deploy | |
| WS_DOCKER_TAG: ${{ env.CODE_VERSION }} | |
| # passwords | |
| WS_API_DB_PASS: ${{ secrets.WS_API_DB_PASS }} | |
| WS_MAPBOX_ACCESS_TOKEN: ${{ secrets.WS_MAPBOX_ACCESS_TOKEN }} | |
| WS_OSM_DB_PASS: ${{ secrets.WS_OSM_DB_PASS }} | |
| WS_OSM_SECRET_KEY_BASE: ${{ secrets.WS_OSM_SECRET_KEY_BASE }} | |
| WS_SMTP_PASS: ${{ secrets.WS_SMTP_PASS }} | |
| WS_TASKS_DB_PASS: ${{ secrets.WS_TASKS_DB_PASS }} | |
| WS_TASKS_SECRET_KEY: ${{ secrets.WS_TASKS_SECRET_KEY }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| eval `ssh-agent -s` | |
| ssh-keyscan ${{ vars.AZURE_DOCKER_HOST_IP }} >> ~/.ssh/known_hosts | |
| echo "${{ secrets.GH_ACTIONS_SSH_KEY }}" > ~/.ssh/github_actions | |
| chmod 600 ~/.ssh/github_actions | |
| ssh-add ~/.ssh/github_actions | |
| docker context create dev --docker "host=ssh://github-actions@${{ vars.AZURE_DOCKER_HOST_IP }}" | |
| docker context use dev | |
| # remove images no longer in use--may need disk space to pull | |
| docker image prune -a -f | |
| # pull new images, recreate containers | |
| docker compose -f docker-compose.deploy.yml --env-file tdei_uw.env up -d --force-recreate --remove-orphans | |