Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #52 from DomainDrivenArchitecture/automate_gh_release
Browse files Browse the repository at this point in the history
Automate gh release
  • Loading branch information
yogthos committed Jun 29, 2020
2 parents 8409e5f + 43497f4 commit 24627ce
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 38 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/dev-build.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 39 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
### 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

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

Expand Down
6 changes: 4 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
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/
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)
Expand All @@ -29,14 +30,15 @@ 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/
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
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 24627ce

Please sign in to comment.