diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 000000000..592c3f214 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,20 @@ +name: Pull Request Build + +on: + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: Build book + run: bundle exec rake book:build diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml new file mode 100644 index 000000000..1496f42b1 --- /dev/null +++ b/.github/workflows/release-on-merge.yml @@ -0,0 +1,38 @@ +name: Release on push to master + +on: + push: + branches: [ master ] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Compute tag name + id: compute-tag + run: | + echo Computing next tag number + LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) + PATCH=$(($LASTPATCH+1)) + echo "::set-output name=tagname::2.1.${PATCH}" + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: Build release assets + run: bundle exec rake book:build + + - name: Create release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.compute-tag.outputs.tagname }} + commit: master + artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'