From f11b1dadd16ccab527c5a4bf96545ceacf2204ef Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 09:11:47 +0200 Subject: [PATCH 01/22] add build status badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index effafe1..104b856 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ### description +![Node.js CI](https://github.com/yogthos/mastodon-bot/workflows/Node.js%20CI/badge.svg) + the bot will post the timeline from the specified Twitter/Tumblr accounts and RSS feeds to Mastodon ### installation From 43b03b2740089ab8bc979d6bd511c40081d2800c Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 09:23:46 +0200 Subject: [PATCH 02/22] rename --- .github/workflows/{dev-build.yml => test-matrix.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{dev-build.yml => test-matrix.yml} (94%) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/test-matrix.yml similarity index 94% rename from .github/workflows/dev-build.yml rename to .github/workflows/test-matrix.yml index bd51116..e674e41 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/test-matrix.yml @@ -2,7 +2,7 @@ name: Node.js CI on: push: - branches: [ master, transformation ] + branches: [ master, automate_gh_release ] pull_request: branches: [ master ] From 7d1f729bacd57f7f3080e246454710a25c4e4ac3 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 09:23:59 +0200 Subject: [PATCH 03/22] separate test & release --- .github/workflows/release-dev.yml | 32 +++++++++++++++++++++++++++++++ .github/workflows/test-matrix.yml | 10 ++-------- 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release-dev.yml diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml new file mode 100644 index 0000000..f2f8b82 --- /dev/null +++ b/.github/workflows/release-dev.yml @@ -0,0 +1,32 @@ +name: Node.js CI + +on: + push: + branches: [ master, automate_gh_release ] + pull_request: + branches: [ master ] + +jobs: + release-dev: + name: release dev + needs: test-matrix + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm install -g --save-dev shadow-cljs + - run: shadow-cljs release app + - run: rm -rf target/npm-build + - run: mkdir target/npm-build + - run: cp mastodon-bot.js target/npm-build/ + - run: cp package.json target/npm-build/ + - run: cp README.md target/npm-build/ + - run: tar -cz -C target/npm-build -f target/npm-build.tgz . diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index e674e41..b32fc25 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -7,7 +7,8 @@ on: branches: [ master ] jobs: - build: + test-matrix: + name: matrix test runs-on: ubuntu-latest strategy: matrix: @@ -22,10 +23,3 @@ jobs: - run: npm install - run: npm install -g --save-dev shadow-cljs - run: shadow-cljs compile test - - run: shadow-cljs release app - - run: rm -rf target/npm-build - - run: mkdir target/npm-build - - run: cp mastodon-bot.js target/npm-build/ - - run: cp package.json target/npm-build/ - - run: cp README.md target/npm-build/ - - run: tar -cz -C target/npm-build -f target/npm-build.tgz . From c6187eb17872c0e3a9cfddf628d29bd8fdd21a28 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 09:26:28 +0200 Subject: [PATCH 04/22] uff, no sharing between workflows?! --- .github/workflows/release-dev.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index f2f8b82..1f8866d 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -7,6 +7,23 @@ on: branches: [ master ] jobs: + test-matrix: + name: matrix test + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm install -g --save-dev shadow-cljs + - run: shadow-cljs compile test + release-dev: name: release dev needs: test-matrix From b009b533b44173eb6e34017019f99c84fabec5d1 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 09:56:37 +0200 Subject: [PATCH 05/22] test package a release --- .github/workflows/release-dev.yml | 26 ++++++++++++++++++++++++-- .github/workflows/test-matrix.yml | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 1f8866d..881853d 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -24,7 +24,7 @@ jobs: - run: npm install -g --save-dev shadow-cljs - run: shadow-cljs compile test - release-dev: + release-build-dev: name: release dev needs: test-matrix runs-on: ubuntu-latest @@ -42,8 +42,30 @@ jobs: - run: npm install -g --save-dev shadow-cljs - run: shadow-cljs release app - run: rm -rf target/npm-build - - run: mkdir target/npm-build + - run: mkdir -p target/npm-build - run: cp mastodon-bot.js target/npm-build/ - run: cp package.json target/npm-build/ - run: cp README.md target/npm-build/ - run: tar -cz -C target/npm-build -f target/npm-build.tgz . + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: true + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./mastodon-bot.js + asset_name: mastodon-bot.js + asset_content_type: application/json + \ No newline at end of file diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index b32fc25..5ac3c55 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -2,7 +2,7 @@ name: Node.js CI on: push: - branches: [ master, automate_gh_release ] + branches: [ never ] pull_request: branches: [ master ] From 65d4c54bb6f6bf40037c42010ef1ee41e61a33dd Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 13:15:11 +0200 Subject: [PATCH 06/22] try to express dev/prod release --- .github/workflows/release-dev.yml | 5 +- .github/workflows/release-prod.yml | 70 +++++++++++++++++++ .../{test-matrix.yml => test-pr.yml} | 2 - 3 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release-prod.yml rename .github/workflows/{test-matrix.yml => test-pr.yml} (93%) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 881853d..75cbaf3 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -3,8 +3,7 @@ name: Node.js CI on: push: branches: [ master, automate_gh_release ] - pull_request: - branches: [ master ] + tags: '![0-9]+.[0-9]+.[0-9]+' jobs: test-matrix: @@ -47,7 +46,7 @@ jobs: - run: cp package.json target/npm-build/ - run: cp README.md target/npm-build/ - run: tar -cz -C target/npm-build -f target/npm-build.tgz . - + - name: Create Release id: create_release uses: actions/create-release@v1 diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml new file mode 100644 index 0000000..8584927 --- /dev/null +++ b/.github/workflows/release-prod.yml @@ -0,0 +1,70 @@ +name: Node.js CI + +on: + push: + branches: [ master, automate_gh_release ] + tags: '[0-9]+.[0-9]+.[0-9]+' + +jobs: + test-matrix: + name: matrix test + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm install -g --save-dev shadow-cljs + - run: shadow-cljs compile test + + release-build-dev: + name: release dev + needs: test-matrix + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm install -g --save-dev shadow-cljs + - run: shadow-cljs release app + - run: rm -rf target/npm-build + - run: mkdir -p target/npm-build + - run: cp mastodon-bot.js target/npm-build/ + - run: cp package.json target/npm-build/ + - run: cp README.md target/npm-build/ + - run: tar -cz -C target/npm-build -f target/npm-build.tgz . + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./mastodon-bot.js + asset_name: mastodon-bot.js + asset_content_type: application/json + \ No newline at end of file diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-pr.yml similarity index 93% rename from .github/workflows/test-matrix.yml rename to .github/workflows/test-pr.yml index 5ac3c55..b636255 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-pr.yml @@ -1,8 +1,6 @@ name: Node.js CI on: - push: - branches: [ never ] pull_request: branches: [ master ] From f9f75a23243810d20457cd9403f68669cee3f4b8 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 13:18:27 +0200 Subject: [PATCH 07/22] next try ... --- .github/workflows/release-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 75cbaf3..55003af 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -3,7 +3,7 @@ name: Node.js CI on: push: branches: [ master, automate_gh_release ] - tags: '![0-9]+.[0-9]+.[0-9]+' + tags-ignore: '[0-9]+.[0-9]+.[0-9]+' jobs: test-matrix: From 929505b553f6f158e29172a464460e2260d7c192 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 13:27:51 +0200 Subject: [PATCH 08/22] next try --- .github/workflows/release-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 55003af..d49b6ac 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -2,8 +2,7 @@ name: Node.js CI on: push: - branches: [ master, automate_gh_release ] - tags-ignore: '[0-9]+.[0-9]+.[0-9]+' + branches: [ '!master' ] jobs: test-matrix: From d6caab9d783c836fb839f673651189681b82de38 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 13:30:29 +0200 Subject: [PATCH 09/22] next try --- .github/workflows/release-dev.yml | 4 ++-- .github/workflows/release-prod.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index d49b6ac..bc804ad 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -2,7 +2,7 @@ name: Node.js CI on: push: - branches: [ '!master' ] + branches-ignore: [ 'master' ] jobs: test-matrix: @@ -54,7 +54,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} - draft: true + draft: false prerelease: true - name: Upload Release Asset id: upload-release-asset diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 8584927..609203f 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -2,7 +2,7 @@ name: Node.js CI on: push: - branches: [ master, automate_gh_release ] + branches: [ master ] tags: '[0-9]+.[0-9]+.[0-9]+' jobs: From 8ceded612201f6cf5775ff3aa24aa7529b4b8d03 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 13:40:34 +0200 Subject: [PATCH 10/22] try #3 --- .github/workflows/release-dev.yml | 2 +- .github/workflows/release-prod.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index bc804ad..978da05 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -2,7 +2,7 @@ name: Node.js CI on: push: - branches-ignore: [ 'master' ] + tags: '![0-9]+.[0-9]+.[0-9]+' jobs: test-matrix: diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 609203f..3661983 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -2,7 +2,6 @@ name: Node.js CI on: push: - branches: [ master ] tags: '[0-9]+.[0-9]+.[0-9]+' jobs: From ba065753b259be6d3f72ab8dfdd68958f4b5f2d0 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 17:35:04 +0200 Subject: [PATCH 11/22] add caching & use single wf & steps --- .github/workflows/release-dev.yml | 52 +++++++++++++++--------------- .github/workflows/release-prod.yml | 51 +++++++++++++++-------------- .github/workflows/test-pr.yml | 22 ++++++++++--- 3 files changed, 70 insertions(+), 55 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 978da05..c1f4cfe 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -1,5 +1,4 @@ -name: Node.js CI - +name: release dev on: push: tags: '![0-9]+.[0-9]+.[0-9]+' @@ -14,37 +13,38 @@ jobs: steps: - uses: actions/checkout@v2 + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm install -g --save-dev shadow-cljs - - run: shadow-cljs compile test - - release-build-dev: - name: release dev - needs: test-matrix - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] + run: npm install + run: npm install -g --save-dev shadow-cljs + run: shadow-cljs compile test - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: build release with node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm install -g --save-dev shadow-cljs - - run: shadow-cljs release app - - run: rm -rf target/npm-build - - run: mkdir -p target/npm-build - - run: cp mastodon-bot.js target/npm-build/ - - run: cp package.json target/npm-build/ - - run: cp README.md target/npm-build/ - - run: tar -cz -C target/npm-build -f target/npm-build.tgz . + run: shadow-cljs release app + run: mkdir -p target/npm-build + run: cp mastodon-bot.js target/npm-build/ + run: cp package.json target/npm-build/ + run: cp README.md target/npm-build/ + run: tar -cz -C target/npm-build -f target/npm-build.tgz . - name: Create Release id: create_release @@ -56,6 +56,7 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: true + - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 @@ -66,4 +67,3 @@ jobs: asset_path: ./mastodon-bot.js asset_name: mastodon-bot.js asset_content_type: application/json - \ No newline at end of file diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 3661983..1806229 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: release prod on: push: @@ -14,37 +14,38 @@ jobs: steps: - uses: actions/checkout@v2 + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm install -g --save-dev shadow-cljs - - run: shadow-cljs compile test + run: npm install + run: npm install -g --save-dev shadow-cljs + run: shadow-cljs compile test - release-build-dev: - name: release dev - needs: test-matrix - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: build release with node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm install -g --save-dev shadow-cljs - - run: shadow-cljs release app - - run: rm -rf target/npm-build - - run: mkdir -p target/npm-build - - run: cp mastodon-bot.js target/npm-build/ - - run: cp package.json target/npm-build/ - - run: cp README.md target/npm-build/ - - run: tar -cz -C target/npm-build -f target/npm-build.tgz . + run: shadow-cljs release app + run: mkdir -p target/npm-build + run: cp mastodon-bot.js target/npm-build/ + run: cp package.json target/npm-build/ + run: cp README.md target/npm-build/ + run: tar -cz -C target/npm-build -f target/npm-build.tgz . - name: Create Release id: create_release @@ -56,6 +57,7 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: false + - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 @@ -66,4 +68,3 @@ jobs: asset_path: ./mastodon-bot.js asset_name: mastodon-bot.js asset_content_type: application/json - \ No newline at end of file diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index b636255..45186d5 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: test PR on: pull_request: @@ -14,10 +14,24 @@ jobs: steps: - uses: actions/checkout@v2 + + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm install -g --save-dev shadow-cljs - - run: shadow-cljs compile test + run: npm install + run: npm install -g --save-dev shadow-cljs + run: shadow-cljs compile test From 43a077a641e3a79f04d69fbd00b318a65a1658be Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 17:42:28 +0200 Subject: [PATCH 12/22] separate uses & run steps --- .github/workflows/release-dev.yml | 8 ++++++-- .github/workflows/release-prod.yml | 9 ++++++--- .github/workflows/test-pr.yml | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index c1f4cfe..8eff2df 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -31,14 +31,18 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + + - name: test 'em run: npm install run: npm install -g --save-dev shadow-cljs run: shadow-cljs compile test - - name: build release with node.js ${{ matrix.node-version }} + - name: build release with node.js 14.x uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 14.x + + - name: build 'em run: shadow-cljs release app run: mkdir -p target/npm-build run: cp mastodon-bot.js target/npm-build/ diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 1806229..7675c85 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -1,5 +1,4 @@ name: release prod - on: push: tags: '[0-9]+.[0-9]+.[0-9]+' @@ -32,14 +31,18 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + + - name: test 'em run: npm install run: npm install -g --save-dev shadow-cljs run: shadow-cljs compile test - - name: build release with node.js ${{ matrix.node-version }} + - name: build release with node.js 14.x uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 14.x + + - name: build 'em run: shadow-cljs release app run: mkdir -p target/npm-build run: cp mastodon-bot.js target/npm-build/ diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 45186d5..4d983fb 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -32,6 +32,8 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + + - name: test 'em run: npm install run: npm install -g --save-dev shadow-cljs run: shadow-cljs compile test From 853d87a6869f9842b434e0f0d7bd1079f6f93cc6 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 17:50:14 +0200 Subject: [PATCH 13/22] improve caching --- .github/workflows/test-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 4d983fb..2233f70 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -21,7 +21,7 @@ jobs: cache-name: cache-node-modules with: # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm + path: /usr/lib/node_modules key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- From e2bf78f090a657dc1662dbc88f973f149dcde85a Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 17:51:30 +0200 Subject: [PATCH 14/22] try #518 :-( --- .github/workflows/release-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 8eff2df..1e448e4 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -1,7 +1,7 @@ name: release dev on: push: - tags: '![0-9]+.[0-9]+.[0-9]+' + ignore-branch: '!master' jobs: test-matrix: From dc7818e7757fbb02b8bfd4d6ef7f8053e0398b69 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 17:58:40 +0200 Subject: [PATCH 15/22] one more try #899 --- .github/workflows/release-dev.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 1e448e4..095831a 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -32,23 +32,25 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: test 'em - run: npm install - run: npm install -g --save-dev shadow-cljs - run: shadow-cljs compile test + - name: test em + run: + - npm install + - npm install -g --save-dev shadow-cljs + - shadow-cljs compile test - name: build release with node.js 14.x uses: actions/setup-node@v1 with: node-version: 14.x - - name: build 'em - run: shadow-cljs release app - run: mkdir -p target/npm-build - run: cp mastodon-bot.js target/npm-build/ - run: cp package.json target/npm-build/ - run: cp README.md target/npm-build/ - run: tar -cz -C target/npm-build -f target/npm-build.tgz . + - name: build em + run: + - shadow-cljs release app + - mkdir -p target/npm-build + - cp mastodon-bot.js target/npm-build/ + - cp package.json target/npm-build/ + - cp README.md target/npm-build/ + - tar -cz -C target/npm-build -f target/npm-build.tgz . - name: Create Release id: create_release From 80681be78634e7ec2d85f0c8c2983f8ce7a3bdef Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:06:14 +0200 Subject: [PATCH 16/22] try to fix run --- .github/workflows/release-dev.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 095831a..c0cb38b 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -33,10 +33,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: test em - run: - - npm install - - npm install -g --save-dev shadow-cljs - - shadow-cljs compile test + run: npm install && npm install -g --save-dev shadow-cljs && shadow-cljs compile test - name: build release with node.js 14.x uses: actions/setup-node@v1 @@ -44,13 +41,7 @@ jobs: node-version: 14.x - name: build em - run: - - shadow-cljs release app - - mkdir -p target/npm-build - - cp mastodon-bot.js target/npm-build/ - - cp package.json target/npm-build/ - - cp README.md target/npm-build/ - - tar -cz -C target/npm-build -f target/npm-build.tgz . + run: shadow-cljs release app && mkdir -p target/npm-build && cp mastodon-bot.js target/npm-build/ && cp package.json target/npm-build/ && cp README.md target/npm-build/ && tar -cz -C target/npm-build -f target/npm-build.tgz . - name: Create Release id: create_release From 507a83969eda5bd8efee0f19c14e95eeace62f0f Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:13:55 +0200 Subject: [PATCH 17/22] no mor matrix for release --- .github/workflows/release-dev.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index c0cb38b..851b872 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [14.x] steps: - uses: actions/checkout@v2 @@ -33,15 +33,19 @@ jobs: node-version: ${{ matrix.node-version }} - name: test em - run: npm install && npm install -g --save-dev shadow-cljs && shadow-cljs compile test - - - name: build release with node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: 14.x + run: | + npm install && \ + npm install -g --save-dev shadow-cljs && \ + shadow-cljs compile test - name: build em - run: shadow-cljs release app && mkdir -p target/npm-build && cp mastodon-bot.js target/npm-build/ && cp package.json target/npm-build/ && cp README.md target/npm-build/ && tar -cz -C target/npm-build -f target/npm-build.tgz . + run: | + shadow-cljs release app && \ + mkdir -p target/npm-build && \ + cp mastodon-bot.js target/npm-build/ && \ + cp package.json target/npm-build/ && \ + cp README.md target/npm-build/ && \ + tar -cz -C target/npm-build -f target/npm-build.tgz . - name: Create Release id: create_release From a150b1faa97152c3e69f3978a4a135dcd48ec2e3 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:20:52 +0200 Subject: [PATCH 18/22] there is no mkdir ?? --- .github/workflows/release-dev.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 851b872..c2c177c 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -40,11 +40,14 @@ jobs: - name: build em run: | - shadow-cljs release app && \ - mkdir -p target/npm-build && \ - cp mastodon-bot.js target/npm-build/ && \ - cp package.json target/npm-build/ && \ - cp README.md target/npm-build/ && \ + shadow-cljs release app + + - name: package release + run: | + mkdir -p target/npm-build + cp mastodon-bot.js target/npm-build/ + cp package.json target/npm-build/ + cp README.md target/npm-build/ tar -cz -C target/npm-build -f target/npm-build.tgz . - name: Create Release From 43be60f8e48d46512745c53b096ee1532b6c2284 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:28:09 +0200 Subject: [PATCH 19/22] found no way to do a release without tag --- .github/workflows/release-prod.yml | 73 ------------------- .../{release-dev.yml => release.yml} | 8 +- 2 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/release-prod.yml rename .github/workflows/{release-dev.yml => release.yml} (93%) diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml deleted file mode 100644 index 7675c85..0000000 --- a/.github/workflows/release-prod.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: release prod -on: - push: - tags: '[0-9]+.[0-9]+.[0-9]+' - -jobs: - test-matrix: - name: matrix test - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [10.x, 12.x, 14.x] - - steps: - - uses: actions/checkout@v2 - - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: test 'em - run: npm install - run: npm install -g --save-dev shadow-cljs - run: shadow-cljs compile test - - - name: build release with node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: build 'em - run: shadow-cljs release app - run: mkdir -p target/npm-build - run: cp mastodon-bot.js target/npm-build/ - run: cp package.json target/npm-build/ - run: cp README.md target/npm-build/ - run: tar -cz -C target/npm-build -f target/npm-build.tgz . - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./mastodon-bot.js - asset_name: mastodon-bot.js - asset_content_type: application/json diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release.yml similarity index 93% rename from .github/workflows/release-dev.yml rename to .github/workflows/release.yml index c2c177c..781fce8 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ -name: release dev +name: release prod on: push: - ignore-branch: '!master' + tags: '[0-9]+.[0-9]+.[0-9]+' jobs: test-matrix: @@ -34,8 +34,8 @@ jobs: - name: test em run: | - npm install && \ - npm install -g --save-dev shadow-cljs && \ + npm install + npm install -g --save-dev shadow-cljs shadow-cljs compile test - name: build em From f8ac1d2df37487a33b25495d6b210e892b15419c Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:47:22 +0200 Subject: [PATCH 20/22] --tag has no impact? --- RELEASING.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 5909359..a427a09 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -5,6 +5,7 @@ shadow-cljs compile test shadow-cljs release app +chmod a+x mastodon-bot.js rm -rf target/npm-build mkdir target/npm-build cp mastodon-bot.js target/npm-build/ @@ -12,7 +13,7 @@ cp package.json target/npm-build/ cp README.md target/npm-build/ tar -cz -C target/npm-build -f target/npm-build.tgz . -npm publish ./target/npm-build.tgz --access public --tag dev0 +npm publish ./target/npm-build.tgz --access public ``` ## prod release (should be done from master) @@ -29,6 +30,7 @@ git push && git push --tag shadow-cljs release app shadow-cljs release app +chmod a+x mastodon-bot.js rm -rf target/npm-build mkdir target/npm-build cp mastodon-bot.js target/npm-build/ @@ -36,7 +38,7 @@ cp package.json target/npm-build/ cp README.md target/npm-build/ tar -cz -C target/npm-build -f target/npm-build.tgz . -npm publish ./target/npm-build.tgz --access public --tag [version] +npm publish ./target/npm-build.tgz --access public # Bump version vi shadow-cljs.edn From b231fc5209a166a7a8a58b1ca02e6aa776890733 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:47:55 +0200 Subject: [PATCH 21/22] works :-) --- README.md | 8 ++++++-- package.json | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 104b856..07455c0 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,12 @@ the bot will post the timeline from the specified Twitter/Tumblr accounts and RS ### installation -1. install [Node.js](https://nodejs.org/en/) -2. run `npm install` to install Node modules +1. prerequisits +1.1 [Node.js](https://nodejs.org/en/) +1.2 npm +2. install with `sudo npm install mastodon-bot -g` +3. run with `mastodon-bot -h` + ### usage diff --git a/package.json b/package.json index 8fce2f1..7cbb33d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "mastodon-bot", "description": "Bot to publish twitter, tumblr or rss posts to an mastodon account.", "author": "Dmitri Sotnikov", - "version": "0.1.0-dev-0", + "version": "0.1.0-dev-1", "homepage": "https://github.com/yogthos/mastodon-bot", "repository": "https://github.com/yogthos/mastodon-bot", "license": "MIT", @@ -18,8 +18,8 @@ "shadow-cljs": "^2.8.37" }, "main": "mastodon-bot.js", - "scripts": { - "start": "node mastodon-bot.js" + "bin": { + "mastodon-bot": "./mastodon-bot.js" }, "keywords": [ "cljs", From 43497f4cd3b7ea57f77ee6ce99af1f450d76b962 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 29 Jun 2020 18:48:47 +0200 Subject: [PATCH 22/22] maybe executable flag is also important to release artefact? --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 781fce8..ee282c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,10 +41,11 @@ jobs: - name: build em run: | shadow-cljs release app + chmod a+x mastodon-bot.js - name: package release run: | - mkdir -p target/npm-build + mkdir -p target/npm-build cp mastodon-bot.js target/npm-build/ cp package.json target/npm-build/ cp README.md target/npm-build/