-
Notifications
You must be signed in to change notification settings - Fork 455
66 lines (62 loc) · 2.58 KB
/
deploy-router-vue-storefront-cloud.yml
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
name: Deploy nginx router
on:
push:
branches:
- v2
- v2-patch/**
- v2-release/**
- v2-develop
jobs:
configure-enviroment:
name: Setup enviroment
uses: vuestorefront/storefront-ui/.github/workflows/configure-environment.yml@v2-develop
build:
needs: configure-enviroment
uses: vuestorefront/storefront-ui/.github/workflows/image-build-vue-storefront-cloud.yml@v2-develop
secrets: inherit
with:
DOCKER_NAMESPACE: ${{ needs.configure-enviroment.outputs.docker-namespace }}
ARTIFACT_TYPE: "vue-storefront"
DOCKERFILE_PATH: ".vuestorefrontcloud/router/docker/Dockerfile"
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}
deploy:
runs-on: ubuntu-latest
needs: [configure-enviroment, build]
permissions:
deployments: write
steps:
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: ${{ github.token }}
target_url: https://docs.storefrontui.io
environment: ${{ needs.configure-enviroment.outputs.environment }}
initial_status: in_progress
- name: Deploy to demo.storefrontui.io
run: |
if curl -s -H 'X-User-Id: ${{ secrets.CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X PATCH -d '{"front_version":"${{ github.sha }}"}' https://farmer.vuestorefront.cloud/instance/${{ needs.configure-enviroment.outputs.farmer-instance-name }} | grep -q '"code":200'; then
echo "Instance updated"
else
echo "Something went wrong during the update process..."
exit 1
fi
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: ${{ needs.configure-enviroment.outputs.target-domain }}
state: "success"
description: Congratulations! The deploy is done.
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: ${{ needs.configure-enviroment.outputs.target-domain }}
description: Unfortunately, the instance hasn't been updated.
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}