This commit is contained in:
Serhii Londar 2018-11-14 23:40:17 +02:00
parent cb090f3996
commit 367ae86550
3 changed files with 34 additions and 9 deletions

View file

@ -200,7 +200,7 @@ class ReadmeGenerator {
func generateReadme() {
print("Start")
guard let applicationsData = try? Data(contentsOf: URL(fileURLWithPath: FilePaths.apps .rawValue)) else { return }
guard let applicationsData = try? Data(contentsOf: URL(fileURLWithPath: FilePaths.applications.rawValue)) else { return }
guard let categoriesData = try? Data(contentsOf: URL(fileURLWithPath: FilePaths.categories.rawValue)) else { return }
let jsonDecoder = JSONDecoder()
guard let applicationsObject = try? jsonDecoder.decode(JSONApplications.self, from: applicationsData) else { return }
@ -284,11 +284,9 @@ extension JSONApplication {
}
enum FilePaths: String {
case readme = "./README.md"
case newReadme = "./NEWREADME.md"
case apps = "./apps.json"
case applications = "./applications.json"
case categories = "./categories.json"
case readme = "./../README.md"
case applications = "./../applications.json"
case categories = "./../categories.json"
}
struct Constants {

22
.github/deploy.sh vendored Normal file
View file

@ -0,0 +1,22 @@
#!/bin/bash
set -e
if [[ $TRAVIS_BRANCH != 'master' ]]
then
exit
fi
git checkout master
git config user.name "serhii-londar"
git config user.email "serhii.londar@gmail.com"
echo add readme
git add README.md
echo commit
git commit -m "Generate README"
echo push
git push --quiet "https://${GITHUB_TOKEN}@github.com/serhii-londar/open-source-mac-os-apps.git" master:master > /dev/null 2>&1

View file

@ -1,11 +1,16 @@
language: ruby
sudo: required
language: swift
osx_image: xcode10
rvm:
- 2.2
before_script:
- gem install awesome_bot
- gem install danger
script:
- awesome_bot README.md -w https://matrix.org/blog/home/
- awesome_bot applications.json -w https://matrix.org/blog/home/
- danger
after_success:
- swift ./.github/ReadmeGenerator.swift
- ./.github/deploy.sh
notifications:
email: false
email: false