Skip to content

Commit 986d9f4

Browse files
committed
[ci] use github actions for PR and release
1 parent 705b8ad commit 986d9f4

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/workflows/PR.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: PR
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
pull_request:
9+
branches: [ master ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# This workflow contains a single job called "build"
17+
build:
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-latest
20+
21+
# Steps represent a sequence of tasks that will be executed as part of the job
22+
steps:
23+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24+
- uses: actions/checkout@v2
25+
- name: Set up Ruby
26+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
27+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
28+
# uses: ruby/setup-ruby@v1
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: 2.6
32+
33+
# Runs a single command using the runners shell
34+
- name: before install
35+
run: |
36+
wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
37+
sh bootstrap.sh
38+
bundle install
39+
- name: build book
40+
env:
41+
GITHUB_VERSION: "v0.0.0"
42+
run: |
43+
bundle exec rake book:build_action
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release on push to main
2+
3+
on:
4+
push:
5+
branches: [ main, 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+
- name: get bootstrap file
15+
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
16+
- name: run bootstrap
17+
run: sh bootstrap.sh
18+
- name: Compute tag name
19+
id: compute-tag
20+
run: |
21+
echo Computing next tag number
22+
LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3)
23+
PATCH=$(($LASTPATCH+1))
24+
echo "::set-output name=tagname::2.1.${PATCH}"
25+
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: 2.7
31+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
32+
33+
- name: Build release assets
34+
run: bundle exec rake book:build_action
35+
36+
- name: Create release
37+
uses: ncipollo/release-action@v1
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
tag: ${{ steps.compute-tag.outputs.tagname }}
41+
commit: ${{ steps.compute-tag.outputs.branch }}
42+
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'

0 commit comments

Comments
 (0)