forked from alt-research/darkforest-local
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.55 KB
/
build-docker-push-to-azure.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Docker build and push to azure
on:
push:
branches:
- "release"
env:
REGISTRY_NAME: altregistry
DOCKER_REPO: "altregistry.azurecr.io/darkforest-backend"
jobs:
production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS_PRD }}
- name: "Login to the container registry"
uses: azure/docker-login@v1
with:
login-server: altregistry.azurecr.io
username: ${{ secrets.ALTREGISTRY_USERNAME }}
password: ${{ secrets.ALTREGISTRY_PASSWORD }}
- name: "Build and push"
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.DOCKER_REPO }}:${{ github.sha }}
build-args: |
NODE_ENV=${{ secrets.NODE_ENV }}
DEFAULT_RPC=${{ secrets.DEFAULT_RPC }}
DEPLOYER_MNEMONIC=${{ secrets.DEPLOYER_MNEMONIC }}
HARDHAT_NETWORK=${{ secrets.HARDHAT_NETWORK }}
AL_SERVER_PORT=${{ secrets.AL_SERVER_PORT }}
ROUND_START_TIMESTAMP=${{ secrets.ROUND_START_TIMESTAMP }}
ROUND_END_TIMESTAMP=${{ secrets.ROUND_END_TIMESTAMP }}
- name: "Extract static files"
uses: shrink/actions-docker-extract@v1
id: staticpages
with:
image: ${{ env.DOCKER_REPO }}:${{ github.sha }}
path: /app/client/dist/.
- name: "Push static files to azure"
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch --overwrite --account-name prddarkforestaltresearch --auth-mode key -d '$web' -s ${{ steps.staticpages.outputs.destination }}
# - name: "Extract contract files"
# uses: shrink/actions-docker-extract@v1
# id: contractfiles
# with:
# image: ${{ env.DOCKER_REPO }}:${{ github.sha }}
# path: /app/packages/contracts/.
# - name: "Push contract files to azure"
# uses: azure/CLI@v1
# with:
# inlineScript: |
# az storage blob upload-batch --overwrite --account-name prddarkforestaltresearch --auth-mode key -d 'contractinfo' -s ${{ steps.contractfiles.outputs.destination }}
- name: Purge CDN
run: az cdn endpoint purge -n ${{ secrets.AZURE_CDN_ENDPOINT }} --profile-name ${{ secrets.AZURE_CDN_PROFILE_NAME }} --content-paths "/*" --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --no-wait
- name: logout
run: |
az logout
if: always()