-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
63 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: update | ||
|
||
on: | ||
push: | ||
|
||
schedule: | ||
# Run at 11:30 JST | ||
- cron: '30 2 * * *' | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
|
||
- name: Restore cache of data | ||
uses: actions/cache@v4 | ||
with: | ||
path: cache | ||
key: cache-${{ runner.os }}-${{ hashFiles('data/md5') }} | ||
|
||
- name: Download or Restore archive | ||
run: | | ||
if [ -f cache/src.zip ]; then mv cache/src.zip data/src.zip; fi | ||
./bin/zengin download || true | ||
mkdir -p cache | ||
cp data/src.zip cache/src.zip | ||
- name: Update archive | ||
run: ./bin/zengin update | ||
|
||
- name: Commit | ||
run: ./bin/zengin commit | ||
# run on master branch only | ||
if: github.ref == 'refs/heads/master' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ gem 'rubyzip' | |
gem 'thor' | ||
gem 'ruby-progressbar' | ||
gem 'oj' | ||
gem 'circleci' | ||
gem 'csv' | ||
gem 'nkf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
circleci (2.0.3) | ||
bigdecimal (3.1.9) | ||
csv (3.3.2) | ||
moji (1.6) | ||
oj (3.10.1) | ||
rake (13.0.1) | ||
nkf (0.2.0) | ||
oj (3.16.9) | ||
bigdecimal (>= 3.0) | ||
ostruct (>= 0.2) | ||
ostruct (0.6.1) | ||
rake (13.2.1) | ||
romaji (0.2.4) | ||
rake (>= 0.8.0) | ||
ruby-progressbar (1.10.1) | ||
rubyzip (2.1.0) | ||
thor (1.0.1) | ||
ruby-progressbar (1.13.0) | ||
rubyzip (2.4.1) | ||
thor (1.3.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
circleci | ||
csv | ||
moji | ||
nkf | ||
oj | ||
romaji | ||
ruby-progressbar | ||
rubyzip | ||
thor | ||
|
||
BUNDLED WITH | ||
2.1.4 | ||
2.6.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,6 @@ require 'moji' | |
require 'romaji' | ||
require 'oj' | ||
require 'yaml' | ||
require 'circleci' | ||
|
||
CircleCi.configure do |config| | ||
config.token = ENV['ZENGINCI_TOKEN'] | ||
end | ||
|
||
class ZenginCLI < Thor | ||
include Thor::Invocation | ||
|
@@ -87,27 +82,23 @@ class ZenginCLI < Thor | |
end | ||
end | ||
|
||
desc 'ci', 'ci job' | ||
def ci | ||
desc 'commit', 'commit changes' | ||
def commit | ||
now = Time.now | ||
puts "Check and commit updates..." | ||
|
||
inside(ROOT_DIR) do | ||
run('git config user.email "[email protected]"') | ||
run('git config user.name "zeny-man"') | ||
run('git config user.name "github-actions[bot]"') | ||
run('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"') | ||
|
||
run('git add data') | ||
changed = run(%Q{git commit -m "Update: #{now.strftime('%Y / %m / %d')}"}) | ||
if changed | ||
run(%Q{git tag -f #{now.strftime('%Y-%m-%d')}}) | ||
|
||
remote = "[email protected]:#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}.git" | ||
remote = "[email protected]:zengin-code/source-data.git" | ||
run("git push #{remote} master") | ||
run("git push -f --tags #{remote}") | ||
|
||
trigger_build('zengin-rb') | ||
trigger_build('zengin-js') | ||
trigger_build('zengin-py') | ||
end | ||
end | ||
end | ||
|
@@ -172,11 +163,6 @@ class ZenginCLI < Thor | |
end | ||
strigified | ||
end | ||
|
||
def trigger_build(project) | ||
ci = CircleCi::Project.new('zengin-code', project) | ||
ci.build_branch('master', {}, build_parameters: { 'RELEASE_BUILD' => 'TRUE' }) | ||
end | ||
end | ||
|
||
ZenginCLI.start(ARGV) |