Skip to content

Commit 4b99f21

Browse files
authored
Merge pull request progit#1667 from progit/ben/github-actions
Set up GitHub actions for CI and release builds
2 parents 7708643 + 68d21bc commit 4b99f21

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/pr-build.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pull Request Build
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up Ruby
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: 2.7
17+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
18+
19+
- name: Build book
20+
run: bundle exec rake book:build
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release on push to master
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Compute tag name
16+
id: compute-tag
17+
run: |
18+
echo Computing next tag number
19+
LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3)
20+
PATCH=$(($LASTPATCH+1))
21+
echo "::set-output name=tagname::2.1.${PATCH}"
22+
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: 2.7
27+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
28+
29+
- name: Build release assets
30+
run: bundle exec rake book:build
31+
32+
- name: Create release
33+
uses: ncipollo/release-action@v1
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
tag: ${{ steps.compute-tag.outputs.tagname }}
37+
commit: master
38+
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'

0 commit comments

Comments
 (0)