From 5fc428353ce5803aaca6dacaaf04f994b7db8728 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 5 Dec 2022 00:51:38 +0800 Subject: [PATCH] build(cd): migrate CD to GitHub --- .github/workflows/cd.yml | 14 ++++++++ .github/workflows/ci.yml | 1 - .gitignore | 1 - .travis.yml | 51 ---------------------------- _posts/2019-08-09-getting-started.md | 8 ++--- tools/init.sh | 1 - 6 files changed, 17 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/cd.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..af4a885 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,14 @@ +name: CD +on: + push: + branches: [production, docs] + +jobs: + launch: + runs-on: ubuntu-latest + steps: + - run: | + curl -X POST -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ + https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \ + -d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f3652f..e076b33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,6 @@ on: paths-ignore: - '.github/**' - '!.github/workflows/ci.yml' - - '.travis.yml' - '.gitignore' - 'README.md' - 'LICENSE' diff --git a/.gitignore b/.gitignore index 3ff2312..9735d33 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ !.git* !.editorconfig !.nojekyll -!.travis.yml !.husky !.commitlintrc.json !.versionrc.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 56b7c5d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -os: linux -dist: bionic -language: ruby -rvm: 2.7.0 - -addons: - apt: - packages: - - libcurl4-openssl-dev # to avoid SSL error (for htmlproofer) - -# Overriding to drop the `--development` flag which requires the Gemfile.lock at build -install: bundle install --jobs=3 --retry=3 --path=vendor/bundle - -before_script: git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q - -jobs: - include: - - stage: Upgrade - cache: bundler - git: - depth: false # for posts' lastmod - script: eval "$BUILD_CMD" - - - stage: Starter - language: minimal - install: true # skip install step - script: eval "$FLUSH_STARTER" - - - stage: Docs - cache: bundler - git: - depth: false # for posts' lastmod - script: eval "$DOCS_CMD" - -stages: - - name: Upgrade - if: branch = production - - name: Starter - if: branch = production - - name: Docs - if: branch = docs - -notifications: - email: - recipients: - - secure: "fFLqX7uOzFA8RE2AUFlU1mmxMw+rdV6DnODJ/1Gl+3ecNtrv5LeH3c5a4a5ShQqYTrx9BPfD40VRN7UB+lzOdXiWLI9yDGRPPxGG26/WfrKpdQPZilc8zAOEeDnLAJeGZLsUvgmNb3KCXW6S8NPqqh34CfWcTIzjCARhRgO33wcs8X5wP5cugtNqO5Ew/pUcfWcmiuXNX0GNT6l+nL5A7yN+IO5mRHqSRmlfYd5EHhGMTIL4La+Cd1CNv1m4Dl0Ah2cDeJwi5wLnVbqAgunLhAYmDtxIOCVYMTBrP37UiNe/7QeFelyJfODsmMg1mx3WCykbXydC753WVoAlTg6nNoeeI9fmK+/tuLK+sx/KnYfTVGBXQYq39DyV/2o/IfCzEAKImlzFKGD8R13+ddu4B5UML+cby5KBvhTKIGaC5tKoe39z/31UPpy11/EHMCof2BUOzIgu5Hsv4OSNJlw3oRE31oOPn8xP4e7uWR8bRUhAgzN0Cn0ht+UfpemfGAXrp0M3IXQdc9L4azEFqxRhivMTLK/P6INay7IM+DJ30Ht2dWylGw/sxcRTqyNm3YomJQnXIO4xeqTSLulWr80FFHTys3JEDJYrcKvJmpwLFEAOZtwKsZ6ZShrOIA4LE5fgQtakH3ZLJG9a7jVSlMcNIfaSKgjdDQOe6CoRQL7KouA=" - on_success: never - -env: - global: - - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 19645fa..d5eb9c5 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -39,15 +39,13 @@ $ bash tools/init.sh The above command will: -1. Removes some files or directories from your repository: - - `.travis.yml`{: .filepath} - - files under `_posts`{: .filepath} +1. Remove the files in `_posts`{: .filepath} from your repository. 2. If the option `--no-gh` is provided, the directory `.github`{: .filepath} will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook`{: .filepath} of `.github/workflows/pages-deploy.yml.hook`{: .filepath}, and then remove the other files and directories in the folder `.github`{: .filepath}. -3. Removes item `Gemfile.lock` from `.gitignore`{: .filepath}. +3. Remove item `Gemfile.lock` from `.gitignore`{: .filepath}. -4. Creates a new commit to save the changes automatically. +4. Create a new commit to save the changes automatically. ### Installing Dependencies diff --git a/tools/init.sh b/tools/init.sh index c6742f1..656a641 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -66,7 +66,6 @@ init_files() { rm -f ".gitignore.$TEMP_SUFFIX" # remove the other fies - rm -f .travis.yml rm -rf _posts/* # save changes