Skip to content

Commit

Permalink
chore: added GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodf committed Aug 2, 2021
1 parent 92d9d68 commit 3df20d8
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/assingPrToAuthor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PR to Author
on:
pull_request:
types: [opened, ready_for_review, edited, synchronize]

jobs:
assignAuthor:
name: Assing
runs-on: ubuntu-latest
steps:
- uses: samspills/[email protected]
if: github.event_name == 'pull_request' && github.event.action == 'opened'
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
14 changes: 14 additions & 0 deletions .github/workflows/conventionalPrName.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Commitlint
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
lint:
name: Validate PR Title (conventional)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: npm install @commitlint/config-conventional
- uses: JulienKode/[email protected]
78 changes: 78 additions & 0 deletions .github/workflows/docs-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy Docs
on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- shell: bash
run: |
echo "1.0.`date +%s`" > version.txt
- name: Upload version artifact
uses: actions/upload-artifact@v2
with:
name: version
path: version.txt
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(cat version.txt)
- name: Build and publish docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: docs-storefrontcloud-io/v2-magento:${{ steps.get_version.outputs.VERSION }}
registry: registry.storefrontcloud.io
username: ${{ secrets.DOCS_CLOUD_USERNAME }}
password: ${{ secrets.DOCS_CLOUD_PASSWORD }}
workdir: docs
dockerfile: ../.vuestorefrontcloud/docker/docs/Dockerfile
buildoptions: "--compress"

deploy:
if: contains(github.event.pull_request.labels.*.name, 'release') && contains('bloodf|alefbarbeli|domideimel|LiorLindvor|filrak|filipsobol|andrzejewsky|', github.actor)
runs-on: ubuntu-latest
needs: build
steps:
- name: Download version artifact
uses: actions/download-artifact@v2
with:
name: version
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(cat version.txt)
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
target_url: https://docs.europe-west1.gcp.storefrontcloud.io/v2
environment: production
initial_status: in_progress
- name: Deploy on docs.europe-west1.gcp.storefrontcloud.io/magento
run: |
if curl -s -H 'X-User-Id: ${{ secrets.DOCS_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DOCS_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"docs","region":"europe-west1.gcp","additionalApps":{"apps":[{"name":"docs-v2-magento","tag":"${{ steps.get_version.outputs.VERSION }}","image":"registry.storefrontcloud.io/docs-storefrontcloud-io/v2-magento","path":"/magento","port":"80"}]}}' 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://docs.europe-west1.gcp.storefrontcloud.io/v2
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://docs.europe-west1.gcp.storefrontcloud.io/v2
description: Unfortunately, the instance hasn't been updated.
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Gitflow Merge & Publish Packages on NPM
on:
workflow_dispatch:
inputs:
npmTag:
description: 'NPM Tag'
required: true
default: 'latest'
jobs:
publishing:
name: Package Publishing
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "14"
registry-url: "https://registry.npmjs.org/"
scope: "@vue-storefront"
- run: echo "" >> .npmrc && echo "@vue-storefront:registry=https://registry.npmjs.org/" >> .npmrc
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: yarn build:api-client && yarn publish:api-client "${{ github.event.inputs.npmTag }}" "$NODE_AUTH_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: yarn build:composables && yarn publish:composables "${{ github.event.inputs.npmTag }}" "$NODE_AUTH_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 3df20d8

Please sign in to comment.