From 4c7b800672fb4c522444af02994201cf6c0b93d8 Mon Sep 17 00:00:00 2001 From: Roman Stoffel Date: Fri, 13 Aug 2021 10:30:18 +0200 Subject: [PATCH] Use Github Workflow Instead of Travis.org Since June 15th, 2021, the building on travis-ci is ceased. Therefore, switch to Github actions, as it is good enough for our use case. REPOTMPL-179 --- .github/workflows/deploy-pages.yml | 25 +++++++++++++++++++++++++ .travis.yml | 15 --------------- README.md | 17 +++-------------- package.json | 4 +--- scripts/deploy-branch.js | 16 ---------------- 5 files changed, 29 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/deploy-pages.yml delete mode 100644 .travis.yml delete mode 100644 scripts/deploy-branch.js diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..c187719 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,25 @@ +name: Deploy Documentation + +on: + push: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: 'npm' + - run: npm ci + - run: npm run build + - name: Deploy to Github pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./web_deploy diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 22f6294..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: node_js -node_js: - - "node" -deploy: - - skip_cleanup: true - provider: script - script: npm run deploy - on: - branch: master - - skip_cleanup: true - provider: script - script: npm run deploy-branch - on: - all_branches: true - condition: '"$TRAVIS_BRANCH" != "master" && "$TRAVIS_BRANCH" != "gh-pages"' diff --git a/README.md b/README.md index ac7b929..b38e64a 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,4 @@ # Repository Templates for Bitbucket Server REST OpenAPI Specification -[![Build Status](https://travis-ci.org/mibexsoftware/repository-templates-rest-api.svg?branch=master)](https://travis-ci.org/mibexsoftware/repository-templates-rest-api) - -## Steps to finish - -1. Enable [Travis](https://docs.travis-ci.com/user/getting-started/#To-get-started-with-Travis-CI%3A) for your repository (**note**: you already have `.travis.yml` file) -2. [Create GitHub access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/); check `public_repo` on `Select scopes` section. -3. Use the token value as a value for [Travis environment variable](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) with the name `GH_TOKEN` -4. Make a test commit to trigger CI: `git commit --allow-empty -m "Test Travis CI" && git push` -5. Wait until Travis build is finished. You can check progress by clicking on the `Build Status` badge at the top -6. If you did everything correct, https://mibexsoftware.github.io/repository-templates-rest-api/ will lead to your new docs -7. **[Optional]** You can setup [custom domain](https://help.github.com/articles/using-a-custom-domain-with-github-pages/) (just create `web/CNAME` file) -8. Start writing/editing your OpenAPI spec: check out [usage](#usage) section below -9. **[Optional]** If you document public API consider adding it into [APIs.guru](https://APIs.guru) directory using [this form](https://apis.guru/add-api/). -10. Delete this section :smile: ## Links @@ -40,3 +26,6 @@ **TIP:** you can open `swagger-editor`, documentation and `swagger-ui` in parallel 5. Once you finish with the changes you can run tests using: `npm test` 6. Share you changes with the rest of the world by pushing to GitHub :smile: + +### Deployment +1. Merging to master will trigger a Github workflow deploying the latest changes diff --git a/package.json b/package.json index 2cd341f..3e94267 100755 --- a/package.json +++ b/package.json @@ -15,12 +15,10 @@ }, "private": true, "scripts": { - "deploy": "npm run build && deploy-to-gh-pages --update web_deploy", "build": "node ./scripts/build.js", "swagger": "swagger-repo", "test": "swagger-repo validate", - "start": "gulp serve", - "deploy-branch": "node ./scripts/deploy-branch.js" + "start": "gulp serve" }, "engines": { "node" : "10.15.3" diff --git a/scripts/deploy-branch.js b/scripts/deploy-branch.js deleted file mode 100644 index 7208a6f..0000000 --- a/scripts/deploy-branch.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -'use strict'; -require('shelljs/global'); -var path = require('path'); - -set('-e'); -set('-v'); - -var branch = process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH.toLowerCase(); -if (branch && branch !== 'gh-pages') { - var branchPath = path.join('.tmp', 'preview', branch, '/'); - mkdir('-p', branchPath); - exec('npm run swagger bundle -- -o ' + branchPath + 'swagger.json'); - cp('web/index.html', branchPath); - exec('deploy-to-gh-pages --update .tmp'); -}