Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: hide theme and cloud deploy (#413)
Browse files Browse the repository at this point in the history
Co-authored-by: mkucmus <maciejkucmus@gmail.com>
  • Loading branch information
patzick and mkucmus authored Mar 6, 2020
1 parent 21357de commit 3a3f344
Show file tree
Hide file tree
Showing 76 changed files with 1,694 additions and 580 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/deploy-preview-storefrontcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Deploy PR Preview on Storefrontcloud
on:
pull_request:
types: [opened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Build packages
run: |
yarn
yarn build --ci
- name: Create theme project
run: |
mkdir test-project
cd ./test-project
../packages/cli/bin/shopware-pwa init -u ${{ secrets.SHOPWARE_ADMIN_USER }} -p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }}
yarn build
- name: Build and publish docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: shopware-pwa-storefrontcloud-io/vue-storefront:${{ github.sha }}
registry: registry.storefrontcloud.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: ./test-project
buildoptions: "--compress"
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
environment: preview
initial_status: in_progress
- run: echo ::set-env name=PULL_NUMBER::$(echo "$GITHUB_REF" | awk -F / '{print $3}')
- name: Deploy on Storefrontcloud.io
run: |
# remove when fix on cloud is done
curl -s -k https://${{ github.sha }}.shopware-pwa.storefrontcloud.io > /dev/null
sleep 3
# /remove when fix on cloud is done
if curl -s -k https://${{ github.sha }}.shopware-pwa.storefrontcloud.io | grep -q '<html data-n-head-ssr'; then
echo "Instance updated"
# curl -s -X GET \
# https://api.github.com/repos/DivanteLtd/shopware-pwa/issues/${{env.PULL_NUMBER}}/comments \
# -H 'Accept: application/vnd.github.shadow-cat-preview+json' | grep -B4 '\"login\": \"github-actions\[bot\]"' | grep -A1 '"issue_url":' > comments.json
# grep -Po '"id": ([0-9]+)' comments.json > ids.json
# while read p; do
# commentId=$(echo $p|grep -o '[0-9]\+')
# curl -s -X DELETE \
# https://api.github.com/repos/DivanteLtd/shopware-pwa/issues/comments/$commentId \
# -H "Authorization: token ${{ github.token }}"
# done <ids.json
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: https://${{ github.sha }}.shopware-pwa.storefrontcloud.io
state: "success"
description: Congratulations! The deploy is done.
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Comment PR
if: success()
uses: thollander/actions-comment-pull-request@master
with:
message: ':blue_heart: Shopware-PWA successfully deployed on https://${{ github.sha }}.shopware-pwa.storefrontcloud.io :ok_hand:'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
description: Unfortunately, the instance hasn't been updated.
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
72 changes: 72 additions & 0 deletions .github/workflows/deploy-storefrontcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy to Storefrontcloud
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Build packages
run: |
yarn
yarn build --ci
- name: Create theme project
run: |
mkdir test-project
cd ./test-project
../packages/cli/bin/shopware-pwa init -u ${{ secrets.SHOPWARE_ADMIN_USER }} -p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }}
yarn build
- name: Build and publish docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: shopware-pwa-storefrontcloud-io/vue-storefront:${{ github.sha }}
registry: registry.storefrontcloud.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: ./test-project
buildoptions: "--compress"
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
target_url: https://shopware-pwa.storefrontcloud.io
environment: production
initial_status: in_progress
- name: Deploy on Storefrontcloud.io
run: |
if curl -s -u ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"shopware-pwa","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; 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: https://shopware-pwa.storefrontcloud.io
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: https://shopware-pwa.storefrontcloud.io
description: Unfortunately, the instance hasn't been updated.
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
12 changes: 9 additions & 3 deletions .github/workflows/deploy-zeit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Deploy Zeit
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize]
- zeit
# pull_request:
# types: [opened, synchronize]
jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -23,6 +23,12 @@ jobs:
run: |
yarn
yarn build --ci
- name: Create theme project
run: |
mkdir test-project
cd ./test-project
../packages/cli/bin/shopware-pwa init
cd ../
- name: Deploy PR to zeit
if: github.event_name == 'pull_request'
uses: patzick/now-deployment@master
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ docs/
.yalc
yalc.lock
vsf-core-packages/vue
vsf-core-packages/shared
vsf-core-packages/shared
yarn-error.log
test-project/
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ module.exports = {
coverageReporters: ["html", "lcov", "text"],
collectCoverageFrom: [
"packages/*/src/**/*.ts",
"!packages/*/src/**/*.d.ts",
"!packages/default-template/**",
"!packages/cli/**",
"!**/interfaces/**"
],
watchPathIgnorePatterns: ["/node_modules/"],
modulePathIgnorePatterns: [".yalc"],
moduleFileExtensions: ["ts", "tsx", "js", "json"],
moduleNameMapper: {
"^@shopware-pwa/commons/(.*?)$": "<rootDir>/packages/commons/$1",
Expand Down
2 changes: 1 addition & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 2,
"builds": [
{
"src": "packages/default-theme/nuxt.config.js",
"src": "test-project/nuxt.config.js",
"use": "@nuxtjs/now-builder",
"config": {}
}
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
]
},
"scripts": {
"start": "yarn && yarn build --types && node scripts/init.js",
"dev": "node scripts/dev.js",
"dev:client": "yarn dev shopware-6-client -format=esm-bundler",
"dev:composables": "yarn dev composables -format=esm-bundler",
"dev:helpers": "yarn dev helpers -format=esm-bundler",
"dev:nuxt-module": "yarn dev nuxt-module -format=cjs",
"dev:debug": "node --inspect scripts/dev.js",
"build": "node scripts/build.js --types",
"build": "node scripts/build.js",
"postinstall": "node scripts/linkDependencies.js && lerna link",
"lint": "prettier --write --parser typescript 'packages/**/*.ts'",
"test": "jest",
Expand Down Expand Up @@ -58,6 +60,7 @@
"execa": "^4.0.0",
"faker": "^4.1.0",
"fs-extra": "^8.1.0",
"fs-jetpack": "^2.2.3",
"husky": "^4.2.1",
"jest": "^25.1.0",
"lerna": "^3.20.2",
Expand All @@ -79,6 +82,6 @@
"yorkie": "^2.0.0"
},
"engines": {
"node": "10.x"
"node": ">=10.x"
}
}
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
],
"license": "MIT",
"dependencies": {
"gluegun": "^4.1.2"
"gluegun": "^4.1.2",
"unzipper": "^0.10.9"
},
"devDependencies": {
"@types/jest": "^25.1.0",
Expand Down
Loading

0 comments on commit 3a3f344

Please sign in to comment.