Merge pull request #53 from DomainDrivenArchitecture/add_npm_publish

Add npm publish
This commit is contained in:
Dmitri Sotnikov 2020-06-29 15:14:14 -04:00 committed by GitHub
commit f2433d2fef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 22 deletions

View file

@ -1,7 +1,7 @@
name: release prod name: release prod
on: on:
push: push:
tags: '[0-9]+.[0-9]+.[0-9]+' tags: '[0-9]+.[0-9]+.[0-9]+*'
jobs: jobs:
test-matrix: test-matrix:
@ -42,14 +42,8 @@ jobs:
run: | run: |
shadow-cljs release app shadow-cljs release app
chmod a+x mastodon-bot.js chmod a+x mastodon-bot.js
sha256sum mastodon-bot.js > target/mastodon-bot.js.sha256
- name: package release sha512sum mastodon-bot.js > target/mastodon-bot.js.sha512
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 - name: Create Release
id: create_release id: create_release
@ -60,10 +54,10 @@ jobs:
tag_name: ${{ github.ref }} tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }} release_name: Release ${{ github.ref }}
draft: false draft: false
prerelease: true prerelease: false
- name: Upload Release Asset - name: Upload mastodon-bot.js
id: upload-release-asset id: upload-mastodon-bot-js
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -72,3 +66,38 @@ jobs:
asset_path: ./mastodon-bot.js asset_path: ./mastodon-bot.js
asset_name: mastodon-bot.js asset_name: mastodon-bot.js
asset_content_type: application/json asset_content_type: application/json
- name: Upload mastodon-bot.js.sha256
id: upload-mastodon-bot-js-sha256
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/mastodon-bot.js.sha256
asset_name: mastodon-bot.js.sha256
asset_content_type: application/json
- name: Upload mastodon-bot.js.sha512
id: upload-mastodon-bot-js-sha512
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/mastodon-bot.js.sha512
asset_name: mastodon-bot.js.sha512
asset_content_type: application/json
- name: upload to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
mkdir -p target/npm-build
cp mastodon-bot.js target/npm-build/
cp target/mastodon-bot.js.sha256 target/npm-build/
cp target/mastodon-bot.js.sha512 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 .
npm publish ./target/npm-build.tgz --access public --dry-run

View file

@ -3,6 +3,8 @@ name: test PR
on: on:
pull_request: pull_request:
branches: [ master ] branches: [ master ]
push:
ingnored-branches: [ 'master' ]
jobs: jobs:
test-matrix: test-matrix:

View file

@ -3,9 +3,7 @@ FROM node:10-slim
RUN apt-get update && apt-get install --assume-yes software-properties-common && \ RUN apt-get update && apt-get install --assume-yes software-properties-common && \
apt-get install --assume-yes git cron apt-get install --assume-yes git cron
RUN git clone https://github.com/yogthos/mastodon-bot /mastodon-bot && \ RUN npm install -g mastodon-bot
cd /mastodon-bot && npm install && \
npm install -g lumo-cljs
RUN mkdir /config && touch /config/config.edn && touch /var/log/cron.log RUN mkdir /config && touch /config/config.edn && touch /var/log/cron.log

View file

@ -6,11 +6,9 @@ the bot will post the timeline from the specified Twitter/Tumblr accounts and RS
### installation ### installation
1. prerequisits 1. prerequisits: should be installed: [Node.js](https://nodejs.org/en/), npm
1.1 [Node.js](https://nodejs.org/en/) 2. install mastodon-bot with: `sudo npm install mastodon-bot -g`
1.2 npm 3. run with: `mastodon-bot -h`
2. install with `sudo npm install mastodon-bot -g`
3. run with `mastodon-bot -h`
### usage ### usage

View file

@ -2,7 +2,7 @@
"name": "mastodon-bot", "name": "mastodon-bot",
"description": "Bot to publish twitter, tumblr or rss posts to an mastodon account.", "description": "Bot to publish twitter, tumblr or rss posts to an mastodon account.",
"author": "Dmitri Sotnikov", "author": "Dmitri Sotnikov",
"version": "1.0.0", "version": "1.0.1-dev-0",
"homepage": "https://github.com/yogthos/mastodon-bot", "homepage": "https://github.com/yogthos/mastodon-bot",
"repository": "https://github.com/yogthos/mastodon-bot", "repository": "https://github.com/yogthos/mastodon-bot",
"license": "MIT", "license": "MIT",

View file

@ -3,7 +3,7 @@
while true; do while true; do
echo "Polling Bot" echo "Polling Bot"
cd /mastodon-bot cd /mastodon-bot
npm start mastodon-bot
echo "Poll done, waiting 600 seconds" echo "Poll done, waiting 600 seconds"
sleep 600 sleep 600
done done