-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Action workflow to build the book (#50)
* Add GitHub Action workflow to build the book - updated packages & bundler - removed 'kindlegen'. More at tdtds/kindlegen#42 * [GitHub Actions] run only on master Co-authored-by: Alexandre Rousseau <contact@rousseau-alexandre.fr> * store builds in YAML instead of JSON * [GitHub Actions] change tag_name to include version and github run number Co-authored-by: Alexandre Rousseau <contact@rousseau-alexandre.fr> Co-authored-by: Alexandre Rousseau <contact@rousseau-alexandre.fr>
- Loading branch information
1 parent
ddf9009
commit e2746a0
Showing
5 changed files
with
91 additions
and
24 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,49 @@ | ||
name: Build Book | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
- run: bundle install | ||
- run: rake build:CI | ||
- uses: actions/github-script@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs').promises; | ||
const { repo: { owner, repo }, sha } = context; | ||
const release = await github.repos.createRelease({ | ||
owner, repo, | ||
tag_name: `v6.${process.env.GITHUB_RUN_NUMBER}`, | ||
draft: true, | ||
target_commitish: sha | ||
}); | ||
console.log('A release has been created'); | ||
const build_dir = 'build'; | ||
for (let file of await fs.readdir(build_dir)) { | ||
if (file == '.gitkeep') continue; | ||
console.log('uploading', file); | ||
await github.repos.uploadReleaseAsset({ | ||
owner, repo, | ||
release_id: release.data.id, | ||
name: file, | ||
data: await fs.readFile(`${build_dir}/${file}`) | ||
}); | ||
} | ||
console.log('DONE') |
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
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
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
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,2 @@ | ||
5: [en, fr] | ||
6: [en, es, fr] |