From 02ca9d419e1e25f54a5c70a3f90bcbc642d41983 Mon Sep 17 00:00:00 2001 From: Leo Arnold Date: Tue, 23 Apr 2019 00:11:59 +0200 Subject: [PATCH] Fix GitHub pages deployment --- .travis.yml | 11 +---------- rakelib/github.rake | 13 ++++++++++++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 034cc58c..8e0b572c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,13 +38,4 @@ jobs: - stage: Update GitHub Pages if: branch = release rvm: 2.6.1 - script: skip - before_deploy: bundle exec rake github:pages - deploy: - provider: pages - local-dir: doc - github-token: "$GITHUB_TOKEN" - keep-history: true - skip_cleanup: true - on: - branch: release + script: bundle exec rake github:pages diff --git a/rakelib/github.rake b/rakelib/github.rake index e482b914..5a88642c 100644 --- a/rakelib/github.rake +++ b/rakelib/github.rake @@ -9,7 +9,7 @@ namespace :github do end desc 'Generate Yard documentation in /doc' - task pages: ['strings:generate', 'strings:gh_pages:configure'] + task pages: %i[github:token strings:gh_pages:update] desc 'Release the module on GitHub' task release: %i[clean build] do @@ -46,4 +46,15 @@ namespace :github do puts '[GitHub] Module successfully released' end + + task :token do + require 'uri' + + remote_uri = URI(`git remote get-url origin`.strip) + + remote_uri.user = ENV['GITHUB_USERNAME'] + remote_uri.password = ENV['GITHUB_TOKEN'] + + system("git remote set-url origin #{remote_uri}") + end end