44
44
path : dist/*
45
45
if-no-files-found : error
46
46
47
- publish :
48
- name : Deploy ${{ (github.ref == 'refs/heads/master' && 'to production') || 'preview' }}
47
+ publish-netlify :
48
+ name : Deploy ${{ (github.ref == 'refs/heads/master' && 'to Netlify production') || 'Netlify preview' }}
49
49
if : github.event_name == 'push'
50
50
runs-on : ubuntu-latest
51
51
container : httptoolkit/act-build-base
73
73
env :
74
74
NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
75
75
NETLIFY_SITE_ID : ${{ secrets.NETLIFY_SITE_ID }}
76
- timeout-minutes : 1
76
+ timeout-minutes : 1
77
+
78
+ publish-hidora :
79
+ name : Deploy to Docker Hub & Hidora
80
+ if : github.event_name != 'pull_request'
81
+ runs-on : ubuntu-latest
82
+ container : httptoolkit/act-build-base
83
+ needs : build
84
+ steps :
85
+ - uses : actions/checkout@v2
86
+
87
+ - uses : actions/download-artifact@v2
88
+ with :
89
+ name : dist
90
+ path : dist
91
+
92
+ - uses : docker/setup-buildx-action@v1
93
+ - name : Login to DockerHub
94
+ if : github.event_name != 'pull_request'
95
+ uses : docker/login-action@v2
96
+ with :
97
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
98
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
99
+
100
+ - name : Extract Docker metadata
101
+ id : meta
102
+ uses : docker/metadata-action@v3
103
+ with :
104
+ github-token : ${{ secrets.GITHUB_TOKEN }}
105
+ images : httptoolkit/ui
106
+ tags : |
107
+ type=raw,value=prod,enable={{is_default_branch}}
108
+ type=raw,value=latest,enable={{is_default_branch}}
109
+ type=sha
110
+
111
+ - name : Deploy to Docker Hub
112
+ uses : docker/build-push-action@v2
113
+ with :
114
+ context : .
115
+ push : ${{ github.event_name != 'pull_request' }}
116
+ tags : ${{ steps.meta.outputs.tags }}
117
+ labels : ${{ steps.meta.outputs.labels }}
118
+
119
+ - name : Redeploy site
120
+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
121
+ run : |
122
+ sleep 30 # Wait for Docker Hub to fully publish
123
+
124
+ # Trigger a container redeploy:
125
+ curl "https://app.hidora.com/1.0/environment/control/rest/redeploycontainersbygroup?session=$HIDORA_API_TOKEN&envName=htk-ui&nodeGroup=cp&tag=prod&useExistingVolumes=true" | \
126
+ tee /dev/stderr | \
127
+ grep -q 'Node has been successfully updated'
128
+
129
+ # Clear CDN cache to re-request content:
130
+ curl -f --request POST \
131
+ --url https://api.bunny.net/pullzone/1110200/purgeCache \
132
+ --header "AccessKey: $BUNNY_SITE_API_KEY"
133
+ env :
134
+ HIDORA_API_TOKEN : ${{ secrets.HIDORA_API_TOKEN }}
135
+ BUNNY_SITE_API_KEY : ${{ secrets.BUNNY_SITE_API_KEY }}
0 commit comments