Merge pull request #52 from DomainDrivenArchitecture/automate_gh_release

Automate gh release
This commit is contained in:
Dmitri Sotnikov 2020-06-29 13:04:16 -04:00 committed by GitHub
commit 24627ce59b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 128 additions and 38 deletions

View file

@ -1,31 +0,0 @@
name: Node.js CI
on:
push:
branches: [ master, transformation ]
pull_request:
branches: [ master ]
jobs:
build:
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
- 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 .

74
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,74 @@
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: [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
npm install -g --save-dev shadow-cljs
shadow-cljs compile test
- name: build em
run: |
shadow-cljs release app
chmod a+x mastodon-bot.js
- 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
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: 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

39
.github/workflows/test-pr.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: test PR
on:
pull_request:
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: 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: /usr/lib/node_modules
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

View file

@ -1,11 +1,17 @@
### description ### 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 the bot will post the timeline from the specified Twitter/Tumblr accounts and RSS feeds to Mastodon
### installation ### installation
1. install [Node.js](https://nodejs.org/en/) 1. prerequisits
2. run `npm install` to install Node modules 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 ### usage

View file

@ -5,6 +5,7 @@
shadow-cljs compile test shadow-cljs compile test
shadow-cljs release app shadow-cljs release app
chmod a+x mastodon-bot.js
rm -rf target/npm-build rm -rf target/npm-build
mkdir target/npm-build mkdir target/npm-build
cp mastodon-bot.js 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/ cp README.md target/npm-build/
tar -cz -C target/npm-build -f target/npm-build.tgz . 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) ## prod release (should be done from master)
@ -29,6 +30,7 @@ git push && git push --tag
shadow-cljs release app shadow-cljs release app
shadow-cljs release app shadow-cljs release app
chmod a+x mastodon-bot.js
rm -rf target/npm-build rm -rf target/npm-build
mkdir target/npm-build mkdir target/npm-build
cp mastodon-bot.js 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/ cp README.md target/npm-build/
tar -cz -C target/npm-build -f target/npm-build.tgz . 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 # Bump version
vi shadow-cljs.edn vi shadow-cljs.edn

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": "0.1.0-dev-0", "version": "0.1.0-dev-1",
"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",
@ -18,8 +18,8 @@
"shadow-cljs": "^2.8.37" "shadow-cljs": "^2.8.37"
}, },
"main": "mastodon-bot.js", "main": "mastodon-bot.js",
"scripts": { "bin": {
"start": "node mastodon-bot.js" "mastodon-bot": "./mastodon-bot.js"
}, },
"keywords": [ "keywords": [
"cljs", "cljs",