From f594b0c52736085ff034ad1b032b3860615d7590 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sat, 26 Jun 2021 21:41:52 -0600 Subject: [PATCH 01/18] Create ci.yml --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..5790c15e5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: CI + +on: + push: + branches: [ master ] + 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: Run tests + run: bundle exec rake book:build From b8fedcb050f6c6345308fc91924d8f5c378dd4bc Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sat, 26 Jun 2021 21:58:09 -0600 Subject: [PATCH 02/18] Create tag-on-merge.yml --- .github/workflows/tag-on-merge.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/tag-on-merge.yml diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml new file mode 100644 index 000000000..901996cb0 --- /dev/null +++ b/.github/workflows/tag-on-merge.yml @@ -0,0 +1,22 @@ +name: Tag on merge to master + +on: + push: + branches: [ master ] + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Compute tag name + id: compute-tag + run: | + echo Computing next tag number + LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) + echo "::set-output name=tagname::$(($LASTPATCH+1))" + - name: Create Tag + uses: negz/create-tag@v1 + with: + version: ${{ steps.compute-tag.outputs.tagname }} + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From ab68c8f0dca757e76684ccd1f6546a67b69635bf Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 06:42:04 -0600 Subject: [PATCH 03/18] Add release-on-tag workflow --- .github/workflows/ci.yml | 2 +- .github/workflows/release-on-tag.yml | 30 ++++++++++++++++++++++++++++ .github/workflows/tag-on-merge.yml | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-on-tag.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5790c15e5..dbc04f536 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,5 +16,5 @@ jobs: with: ruby-version: 2.7 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Run tests + - name: Run build run: bundle exec rake book:build diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml new file mode 100644 index 000000000..c8efa2add --- /dev/null +++ b/.github/workflows/release-on-tag.yml @@ -0,0 +1,30 @@ +name: Tag on merge to master + +on: + push: + tags: [ '*' ] + +jobs: + tag: + 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: Run build + run: bundle exec rake book:build + + - name: Grab tag name + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Create release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: ${{ env.RELEASE_VERSION }} + artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html' diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index 901996cb0..651e0ec7e 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -9,12 +9,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Compute tag name id: compute-tag run: | echo Computing next tag number LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) echo "::set-output name=tagname::$(($LASTPATCH+1))" + - name: Create Tag uses: negz/create-tag@v1 with: From b0bbdb3ac58abae93b3522a54a256b5f8b154404 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 06:46:53 -0600 Subject: [PATCH 04/18] Adjust whitespace --- .github/workflows/release-on-tag.yml | 4 ++-- .github/workflows/tag-on-merge.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index c8efa2add..a7349efd1 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -15,13 +15,13 @@ jobs: with: ruby-version: 2.7 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - + - name: Run build run: bundle exec rake book:build - name: Grab tag name run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - + - name: Create release uses: ncipollo/release-action@v1 with: diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index 651e0ec7e..fb2ddfa71 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -16,9 +16,9 @@ jobs: echo Computing next tag number LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) echo "::set-output name=tagname::$(($LASTPATCH+1))" - + - name: Create Tag uses: negz/create-tag@v1 with: version: ${{ steps.compute-tag.outputs.tagname }} - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} From 41abef539094ee0bce1f3cfd1a0333be201760b9 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 06:48:23 -0600 Subject: [PATCH 05/18] Names are hard --- .github/workflows/ci.yml | 4 +++- .github/workflows/release-on-tag.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbc04f536..5628e6a15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,12 @@ jobs: 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: Run build + + - name: Build book run: bundle exec rake book:build diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index a7349efd1..30914511e 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -16,7 +16,7 @@ jobs: ruby-version: 2.7 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Run build + - name: Build book run: bundle exec rake book:build - name: Grab tag name From d6e24367cdce2f3f18c669fa88f9057da2554061 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 06:51:12 -0600 Subject: [PATCH 06/18] Tags should be 2.1.xxx --- .github/workflows/tag-on-merge.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index fb2ddfa71..51b6dc094 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -15,7 +15,8 @@ jobs: run: | echo Computing next tag number LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) - echo "::set-output name=tagname::$(($LASTPATCH+1))" + PATCH=$(($LASTPATCH+1)) + echo "::set-output name=tagname::2.1.${PATCH})" - name: Create Tag uses: negz/create-tag@v1 From 4ddfc991305f7f1f1583b127eae7d1bb284ee23a Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 08:35:17 -0600 Subject: [PATCH 07/18] Names are still hard --- .github/workflows/{ci.yml => pr-build.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ci.yml => pr-build.yml} (94%) diff --git a/.github/workflows/ci.yml b/.github/workflows/pr-build.yml similarity index 94% rename from .github/workflows/ci.yml rename to .github/workflows/pr-build.yml index 5628e6a15..e94bb222d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/pr-build.yml @@ -1,4 +1,4 @@ -name: CI +name: Pull Request Build on: push: From 331e79433ee108751b3c35b42cbfc2f30959a143 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 08:35:30 -0600 Subject: [PATCH 08/18] Only run on PRs --- .github/workflows/pr-build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index e94bb222d..592c3f214 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -1,8 +1,6 @@ name: Pull Request Build on: - push: - branches: [ master ] pull_request: branches: [ master ] From f84882cab0ee3f4875864abd89b7680fa65937b5 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 08:36:03 -0600 Subject: [PATCH 09/18] Yup, names are still hard --- .github/workflows/release-on-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 30914511e..654059a53 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -1,4 +1,4 @@ -name: Tag on merge to master +name: Release on tag on: push: From 8c6ae5bc67980c2747cdc0aed5699a95c63246e5 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 08:36:34 -0600 Subject: [PATCH 10/18] Update .github/workflows/tag-on-merge.yml Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> --- .github/workflows/tag-on-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index 51b6dc094..4d33f04b0 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -18,7 +18,7 @@ jobs: PATCH=$(($LASTPATCH+1)) echo "::set-output name=tagname::2.1.${PATCH})" - - name: Create Tag + - name: Create tag uses: negz/create-tag@v1 with: version: ${{ steps.compute-tag.outputs.tagname }} From c347bccfa4c354f5623296089f449c09247f3b10 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 08:53:53 -0600 Subject: [PATCH 11/18] A different tagging action --- .github/workflows/tag-on-merge.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index 4d33f04b0..8678812bb 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -18,8 +18,14 @@ jobs: PATCH=$(($LASTPATCH+1)) echo "::set-output name=tagname::2.1.${PATCH})" - - name: Create tag - uses: negz/create-tag@v1 + - name: Create Tag + uses: actions/github-script@v3 with: - version: ${{ steps.compute-tag.outputs.tagname }} - token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ github.token }} + script: | + github.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "refs/tags/${{ steps.compute-tag.outputs.tagname }}", + sha: context.sha + }) From ca8a4293bfe7cf087ec830c770d5493b623d86d4 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 08:55:14 -0600 Subject: [PATCH 12/18] wups --- .github/workflows/tag-on-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index 8678812bb..c0669240c 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -16,7 +16,7 @@ jobs: 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})" + echo "::set-output name=tagname::2.1.${PATCH}" - name: Create Tag uses: actions/github-script@v3 From 223491938747adaa002164eb32c9f67df82b144d Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Sun, 27 Jun 2021 09:06:27 -0600 Subject: [PATCH 13/18] We'll be needing all of these --- .github/workflows/tag-on-merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/tag-on-merge.yml index c0669240c..768d10e81 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/tag-on-merge.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Compute tag name id: compute-tag From 8932eb6d358acc21ee1f4694da42f9cb492ab8b2 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Mon, 28 Jun 2021 06:20:11 -0700 Subject: [PATCH 14/18] Move release-generation into push-to-master workflow --- ...{tag-on-merge.yml => release-on-merge.yml} | 7 +++++ .github/workflows/release-on-tag.yml | 30 ------------------- 2 files changed, 7 insertions(+), 30 deletions(-) rename .github/workflows/{tag-on-merge.yml => release-on-merge.yml} (75%) delete mode 100644 .github/workflows/release-on-tag.yml diff --git a/.github/workflows/tag-on-merge.yml b/.github/workflows/release-on-merge.yml similarity index 75% rename from .github/workflows/tag-on-merge.yml rename to .github/workflows/release-on-merge.yml index 768d10e81..af2a32eb3 100644 --- a/.github/workflows/tag-on-merge.yml +++ b/.github/workflows/release-on-merge.yml @@ -31,3 +31,10 @@ jobs: ref: "refs/tags/${{ steps.compute-tag.outputs.tagname }}", sha: context.sha }) + + - name: Create release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: ${{ steps.compute-tag.outputs.tagname }} + artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html' diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml deleted file mode 100644 index 654059a53..000000000 --- a/.github/workflows/release-on-tag.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Release on tag - -on: - push: - tags: [ '*' ] - -jobs: - tag: - 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 - - - name: Grab tag name - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - - name: Create release - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: ${{ env.RELEASE_VERSION }} - artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html' From cca8c1f17f3bbaee73559b97e5f4a177e19480e4 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Mon, 28 Jun 2021 06:21:01 -0700 Subject: [PATCH 15/18] namesssss --- .github/workflows/release-on-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml index af2a32eb3..016d0733a 100644 --- a/.github/workflows/release-on-merge.yml +++ b/.github/workflows/release-on-merge.yml @@ -1,4 +1,4 @@ -name: Tag on merge to master +name: Release on push to master on: push: From a360becbb94766397fe69bfc65772b5ab08fedc7 Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Mon, 28 Jun 2021 06:22:29 -0700 Subject: [PATCH 16/18] Let's try this --- .github/workflows/release-on-merge.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml index 016d0733a..4e305c1b3 100644 --- a/.github/workflows/release-on-merge.yml +++ b/.github/workflows/release-on-merge.yml @@ -5,7 +5,7 @@ on: branches: [ master ] jobs: - tag: + release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -21,16 +21,9 @@ jobs: echo "::set-output name=tagname::2.1.${PATCH}" - name: Create Tag - uses: actions/github-script@v3 - with: - github-token: ${{ github.token }} - script: | - github.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: "refs/tags/${{ steps.compute-tag.outputs.tagname }}", - sha: context.sha - }) + run: | + git tag ${{ steps.compute-tag.outputs.tagname }} + git push origin ${{ steps.compute-tag.outputs.tagname }} - name: Create release uses: ncipollo/release-action@v1 From a1296a6810b918a02ee7a7606052d71133fcc79b Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Mon, 28 Jun 2021 06:32:27 -0700 Subject: [PATCH 17/18] Wait this action can create tags too --- .github/workflows/release-on-merge.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml index 4e305c1b3..b8a43efe7 100644 --- a/.github/workflows/release-on-merge.yml +++ b/.github/workflows/release-on-merge.yml @@ -20,14 +20,10 @@ jobs: PATCH=$(($LASTPATCH+1)) echo "::set-output name=tagname::2.1.${PATCH}" - - name: Create Tag - run: | - git tag ${{ steps.compute-tag.outputs.tagname }} - git push origin ${{ steps.compute-tag.outputs.tagname }} - - name: Create release uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - name: ${{ steps.compute-tag.outputs.tagname }} + tag: ${{ steps.compute-tag.outputs.tagname }} + commit: master artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html' From 68d21bca89052a59db2e485bd27e76bb771587cd Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Mon, 28 Jun 2021 06:33:56 -0700 Subject: [PATCH 18/18] duh --- .github/workflows/release-on-merge.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml index b8a43efe7..1496f42b1 100644 --- a/.github/workflows/release-on-merge.yml +++ b/.github/workflows/release-on-merge.yml @@ -20,6 +20,15 @@ jobs: 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: