1+ name : " Release"
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ environment :
6+ description : ' Environment'
7+ required : true
8+ default : ' dev'
9+
10+ jobs :
11+ prep :
12+ runs-on : ubuntu-latest
13+ name : Prep
14+ environment : " dev"
15+ timeout-minutes : 45
16+ steps :
17+ - uses : actions/checkout@v2
18+ with :
19+ submodules : recursive
20+
21+ - name : Set commit SHA as code version
22+ run : echo "CODE_VERSION=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
23+
24+ # - name: Generate release notes
25+ # run:
26+ # ./gen-rel-notes.sh > CHANGELOG
27+
28+
29+ build :
30+ needs : prep
31+ runs-on : ubuntu-latest
32+ name : Build
33+ environment : " dev"
34+ timeout-minutes : 45
35+ steps :
36+ - uses : docker/login-action@v3
37+ with :
38+ registry : ${{ vars.WS_DOCKER_REGISTRY }}
39+ username : ${{ vars.DOCKERHUB_USERNAME }}
40+ password : ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+ - name : Build frontend
43+ uses : docker/build-push-action@v6
44+ with :
45+ context : frontend
46+ push : true
47+ file : Dockerfile
48+ tags : ${WS_DOCKER_REGISTRY}/workspaces-frontend:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-frontend:${CODE_VERSION}
49+
50+ - name : Build osm-cgimap
51+ uses : docker/build-push-action@v6
52+ with :
53+ context : osm-cgimap
54+ push : true
55+ file : docker/ubuntu/Dockerfile2404
56+ tags : ${WS_DOCKER_REGISTRY}/workspaces-osm-cgimap:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-osm-cgimap:${CODE_VERSION}
57+
58+ - name : Build osm-log-proxy
59+ uses : docker/build-push-action@v6
60+ with :
61+ context : osm-log-proxy
62+ push : true
63+ file : Dockerfile
64+ tags : ${WS_DOCKER_REGISTRY}/workspaces-osm-log-proxy:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-osm-log-proxy:${CODE_VERSION}
65+
66+ - name : Build osm-rails
67+ uses : docker/build-push-action@v6
68+ with :
69+ context : osm-rails
70+ push : true
71+ file : Dockerfile.prod
72+ tags : ${WS_DOCKER_REGISTRY}/workspaces-osm-rails:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-osm-rails:${CODE_VERSION}
73+
74+ - name : Build osm-web
75+ uses : docker/build-push-action@v6
76+ with :
77+ context : osm-web
78+ push : true
79+ file : Dockerfile
80+ tags : ${WS_DOCKER_REGISTRY}/workspaces-osm-web:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-osm-web:${CODE_VERSION}
81+
82+ - name : Build pathways-editor
83+ uses : docker/build-push-action@v6
84+ with :
85+ context : pathways-editor
86+ push : true
87+ file : Dockerfile
88+ tags : ${WS_DOCKER_REGISTRY}/workspaces-pathways-editor:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-pathways-editor:${CODE_VERSION}
89+
90+ - name : Build rapid
91+ uses : docker/build-push-action@v6
92+ with :
93+ context : rapid
94+ push : true
95+ file : Dockerfile
96+ tags : ${WS_DOCKER_REGISTRY}/workspaces-rapid:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-rapid:${CODE_VERSION}
97+
98+ - name : Build tasks-backend
99+ uses : docker/build-push-action@v6
100+ with :
101+ context : tasking-manager
102+ push : true
103+ file : ./scripts/docker/Dockerfile.backend
104+ target : prod
105+ build-args : |
106+ APP_UID=1000
107+ tags : ${WS_DOCKER_REGISTRY}/workspaces-tasks-backend:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-tasks-backend:${CODE_VERSION}
108+
109+ - name : Build tasks-frontend
110+ uses : docker/build-push-action@v6
111+ with :
112+ context : tasking-manager
113+ push : true
114+ file : ./scripts/docker/Dockerfile.frontend
115+ build-args : |
116+ TM_APP_API_URL="https://tasks.workspaces-${ENV}.sidewalks.washington.edu/"
117+ tags : ${WS_DOCKER_REGISTRY}/workspaces-tasks-frontend:${ENV}, ${WS_DOCKER_REGISTRY}/workspaces-tasks-frontend:${CODE_VERSION}
118+
119+ deploy :
120+ needs : build
121+ runs-on : ubuntu-latest
122+ name : Build
123+ environment : " dev"
124+ timeout-minutes : 45
125+ steps :
126+ - name : Deploy
127+ env :
128+ ENV : ${{ vars.ENV }}
129+ WS_DOCKER_REGISTRY : ${{ vars.WS_DOCKER_REGISTRY }}
130+
131+ # machine to deploy to
132+ AZURE_DOCKER_HOST_IP : ${{ vars.AZURE_DOCKER_HOST_IP }}
133+
134+ # tag to deploy
135+ WS_DOCKER_TAG : ${{ env.CODE_VERSION }}
136+
137+ # passwords
138+ WS_API_DB_PASS : ${{ secrets.WS_API_DB_PASS }}
139+ WS_MAPBOX_ACCESS_TOKEN : ${{ secrets.WS_MAPBOX_ACCESS_TOKEN }}
140+ WS_OSM_DB_PASS : ${{ secrets.WS_OSM_DB_PASS }}
141+ WS_OSM_SECRET_KEY_BASE : ${{ secrets.WS_OSM_SECRET_KEY_BASE }}
142+ WS_SMTP_PASS : ${{ secrets.WS_SMTP_PASS }}
143+ WS_TASKS_DB_PASS : ${{ secrets.WS_TASKS_DB_PASS }}
144+ WS_TASKS_SECRET_KEY : ${{ secrets.WS_TASKS_SECRET_KEY }}
145+ run : |
146+ mkdir -p ~/.ssh
147+ eval `ssh-agent -s`
148+
149+ ssh-keyscan ${{ vars.AZURE_DOCKER_HOST_IP }} >> ~/.ssh/known_hosts
150+
151+ echo "${{ secrets.GH_ACTIONS_SSH_KEY }}" > ~/.ssh/github_actions
152+ chmod 600 ~/.ssh/github_actions
153+ ssh-add ~/.ssh/github_actions
154+
155+ docker context create dev --docker "host=ssh://github-actions@${{ vars.AZURE_DOCKER_HOST_IP }}"
156+ docker context use dev
157+
158+ # remove images no longer in use--may need disk space to pull
159+ docker image prune -a -f
160+
161+ # pull new images, recreate containers
162+ docker compose -f docker-compose.deploy.yml --env-file tdei_uw.env up -d --force-recreate --remove-orphans
163+
164+
0 commit comments