|
73 | 73 | run: | |
74 | 74 | touch build-image/.uptodate |
75 | 75 | make BUILD_IN_CONTAINER=false web-build |
| 76 | + - name: Upload Website Artifact |
| 77 | + uses: actions/upload-artifact@v2 |
| 78 | + with: |
| 79 | + name: website public |
| 80 | + path: website/public/ |
76 | 81 | - name: Save Images |
77 | 82 | run: | |
78 | 83 | mkdir /tmp/images |
@@ -160,7 +165,87 @@ jobs: |
160 | 165 | - name: Extract Docker Images Archive |
161 | 166 | run: tar -xvf images.tar -C / |
162 | 167 | - name: Run Integration Configs Tests |
| 168 | + # Github Actions does not support TTY in their default runners yet |
163 | 169 | run: | |
164 | 170 | touch build-image/.uptodate |
165 | 171 | MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations |
166 | | - make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-build-image-debian-491e60715-WIP TTY='' configs-integration-test |
| 172 | + make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-build-image-debian-491e60715-WIP TTY='' configs-integration-test |
| 173 | +
|
| 174 | + deploy_website: |
| 175 | + needs: [build, test] |
| 176 | + if: github.ref == 'refs/heads/master' && github.repository == 'cortexproject/cortex' |
| 177 | + runs-on: ubuntu-latest |
| 178 | + container: |
| 179 | + image: quay.io/cortexproject/build-image:upgrade-build-image-debian-491e60715-WIP |
| 180 | + steps: |
| 181 | + - name: Checkout Repo |
| 182 | + uses: actions/checkout@v2 |
| 183 | + with: |
| 184 | + # web-deploy script requires repo to be cloned with ssh for some commands to work |
| 185 | + ssh-key: ${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }} |
| 186 | + - name: Sym Link Expected Path to Workspace |
| 187 | + run: | |
| 188 | + mkdir -p /go/src/github.com/cortexproject/cortex |
| 189 | + ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/cortex |
| 190 | + - name: Download Website Artifact |
| 191 | + uses: actions/download-artifact@v2 |
| 192 | + with: |
| 193 | + name: website public |
| 194 | + path: website/public |
| 195 | + - name: Setup SSH Keys and known_hosts for Github Authentication to Deploy Website |
| 196 | + run: | |
| 197 | + mkdir -p ~/.ssh |
| 198 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
| 199 | + ssh-agent -a $SSH_AUTH_SOCK > /dev/null |
| 200 | + ssh-add - <<< "${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }}" |
| 201 | + env: |
| 202 | + SSH_AUTH_SOCK: /tmp/ssh_agent.sock |
| 203 | + shell: bash |
| 204 | + - name: Deploy Website |
| 205 | + # SSH is used to authentricate with Github because web-deploy script uses git to checkout and push to gh-pages |
| 206 | + run: make BUILD_IN_CONTAINER=false web-deploy |
| 207 | + env: |
| 208 | + SSH_AUTH_SOCK: /tmp/ssh_agent.sock |
| 209 | + GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" |
| 210 | + |
| 211 | + deploy: |
| 212 | + needs: [build, test, lint, integration, integration-configs-db] |
| 213 | + if: github.ref == 'refs/heads/master' && github.repository == 'cortexproject/cortex' |
| 214 | + runs-on: ubuntu-latest |
| 215 | + container: |
| 216 | + image: quay.io/cortexproject/build-image:upgrade-build-image-debian-491e60715-WIP |
| 217 | + steps: |
| 218 | + - name: Checkout Repo |
| 219 | + uses: actions/checkout@v2 |
| 220 | + - name: Install Docker Client |
| 221 | + run: ./.github/workflows/scripts/install-docker.sh |
| 222 | + - name: Sym link Expected Path to Workspace |
| 223 | + run: | |
| 224 | + mkdir -p /go/src/github.com/cortexproject/cortex |
| 225 | + ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/cortex |
| 226 | + - name: Download Docker Images Artifact |
| 227 | + uses: actions/download-artifact@v2 |
| 228 | + with: |
| 229 | + name: Docker Images |
| 230 | + - name: Extract Docker Images Archive |
| 231 | + run: tar -xvf images.tar -C / |
| 232 | + - name: Load Images |
| 233 | + run: | |
| 234 | + ln -s /tmp/images ./docker-images |
| 235 | + make BUILD_IN_CONTAINER=false load-images |
| 236 | + - name: Deploy |
| 237 | + run: | |
| 238 | + if [ -n "$DOCKER_REGISTRY_PASSWORD" ]; then |
| 239 | + docker login -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD" |
| 240 | + fi |
| 241 | + if [ -n "$QUAY_PASSWORD" ]; then |
| 242 | + docker login -u "$QUAY_REGISTRY_USER" -p "$QUAY_REGISTRY_PASSWORD" quay.io; |
| 243 | + fi |
| 244 | + IMAGE_TAG=$GIT_TAG ./push-images $NOQUAY |
| 245 | + env: |
| 246 | + DOCKER_REGISTRY_USER: ${{secrets.DOCKER_REGISTRY_USER}} |
| 247 | + DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} |
| 248 | + QUAY_REGISTRY_USER: ${{secrets.QUAY_USER}} |
| 249 | + QUAY_REGISTRY_PASSWORD: ${{secrets.QUAY_PASSWORD}} |
| 250 | + GIT_TAG: ${{github.event.release.tag_name}} |
| 251 | + NOQUAY: ${{secrets.NOQUAY}} |
0 commit comments