From a4cec4ef90523dc45969b9642dbafa63d6ff83ac Mon Sep 17 00:00:00 2001 From: Maksim Karatkevich Date: Tue, 19 May 2020 16:47:05 +0300 Subject: [PATCH] feat: add guthub actions --- .github/workflows/ACTION_TRIGGER_GUIDE.md | 13 ++++++++++ .github/workflows/demoDeploy.yml | 29 +++++++++++++++++++++++ .github/workflows/docsDeploy.yml | 29 +++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 .github/workflows/ACTION_TRIGGER_GUIDE.md create mode 100644 .github/workflows/demoDeploy.yml create mode 100644 .github/workflows/docsDeploy.yml diff --git a/.github/workflows/ACTION_TRIGGER_GUIDE.md b/.github/workflows/ACTION_TRIGGER_GUIDE.md new file mode 100644 index 00000000..b25cb9a7 --- /dev/null +++ b/.github/workflows/ACTION_TRIGGER_GUIDE.md @@ -0,0 +1,13 @@ +### Actions deploy guide + +In order to trigger workflow action you should execute the following curl: + +`curl -H "Accept: application/vnd.github.everest-preview+json" \` +`-H "Authorization: token " \` +`--request POST \` +`--data '{"event_type": ""}' \` +`https://api.github.com/repos/akveo/ngx-admin/dispatches` + +This curl expects two input parameters: +- `ACCESS_TOKEN`: A personal access token. Creating a [personal access token guide](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) +- `ACTION`: action to trigger ('deploy-docs', 'deploy-to-demo') diff --git a/.github/workflows/demoDeploy.yml b/.github/workflows/demoDeploy.yml new file mode 100644 index 00000000..140f62bb --- /dev/null +++ b/.github/workflows/demoDeploy.yml @@ -0,0 +1,29 @@ + +name: Deploy to demo + +on: + push: + branches: + - 'demo' + paths: + - 'src/**' + repository_dispatch: + types: deploy-to-demo + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + - uses: actions/checkout@v2 + with: + ref: demo + - run: npm install + - run: npm run build:demo:prod + - run: rsync -r --delete-after dist/. "${{ secrets.REMOTE_URL }}":"${{ secrets.ADDRESS }}" diff --git a/.github/workflows/docsDeploy.yml b/.github/workflows/docsDeploy.yml new file mode 100644 index 00000000..b532163a --- /dev/null +++ b/.github/workflows/docsDeploy.yml @@ -0,0 +1,29 @@ + +name: Deploy docs + +on: + push: + branches: + - 'demo' + paths: + - 'docs/**' + repository_dispatch: + types: deploy-docs + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + - uses: actions/checkout@v2 + with: + ref: demo + - name: Deploy + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + npm install --silent + git config --global user.email "github-action@akveo.com" + git config --global user.name "Github Action" + npm run docs:gh-pages