new ci & add doc

This commit is contained in:
jem 2020-07-03 08:38:08 +02:00
parent 6f4161172a
commit 6d2c096cc6
4 changed files with 73 additions and 57 deletions

View file

@ -1,11 +1,9 @@
name: release prod name: build-it
on:
push: push:
tags: '[0-9]+.[0-9]+.[0-9]+*'
jobs: jobs:
release: build-it:
name: release name: build-it
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@ -40,12 +38,14 @@ jobs:
shadow-cljs compile test shadow-cljs compile test
- name: build em - name: build em
if: ${{ github.branch == 'master' }}
run: | run: |
shadow-cljs release lib shadow-cljs release lib
sha256sum target/lib.js > target/dda-masto-embedd.js.sha256 sha256sum target/lib.js > target/dda-masto-embedd.js.sha256
sha512sum target/lib.js > target/dda-masto-embedd.js.sha512 sha512sum target/lib.js > target/dda-masto-embedd.js.sha512
- name: Create Release - name: Create Release
if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }}
id: create_release id: create_release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
@ -57,6 +57,7 @@ jobs:
prerelease: false prerelease: false
- name: Upload masto-embedd.js - name: Upload masto-embedd.js
if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }}
id: upload-masto-embedd-js id: upload-masto-embedd-js
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
@ -68,6 +69,7 @@ jobs:
asset_content_type: application/json asset_content_type: application/json
- name: Upload masto-embedd.js.sha256 - name: Upload masto-embedd.js.sha256
if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }}
id: upload-masto-embedd-js-sha256 id: upload-masto-embedd-js-sha256
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
@ -79,6 +81,7 @@ jobs:
asset_content_type: application/json asset_content_type: application/json
- name: Upload masto-embedd.js.sha512 - name: Upload masto-embedd.js.sha512
if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }}
id: upload-masto-embedd-js-sha512 id: upload-masto-embedd-js-sha512
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
@ -90,6 +93,7 @@ jobs:
asset_content_type: application/json asset_content_type: application/json
- name: upload to npm - name: upload to npm
if: ${{ github.branch == 'master' }}
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: | run: |
@ -99,5 +103,6 @@ jobs:
cp target/dda-masto-embedd.js.sha512 target/npm-build/ cp target/dda-masto-embedd.js.sha512 target/npm-build/
cp package.json target/npm-build/ cp package.json target/npm-build/
cp README.md target/npm-build/ cp README.md target/npm-build/
cp LICENSE 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 npm publish ./target/npm-build.tgz --access public

View file

@ -1,42 +0,0 @@
name: test PR
on:
pull_request:
branches: [ master ]
push:
ingnored-branches: [ 'master' ]
jobs:
test-pr-matrix:
name: matrix test for pull requests
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
npm install -g --save-dev shadow-cljs
shadow-cljs compile test

View file

@ -1,20 +1,44 @@
# dda-masto-embed # dda-masto-embed
Embeds mastodon timline into a html page. Uses JS, no intermediate server required. Embeds mastodon timline into a html page.
* Uses JS, **no intermediate server** required,
* Download latest version at:
* [dda-masto-embed.js](https://domaindrivenarchitecture.org/downloads/downloads/dda-masto-embed.js)
* [dda-masto-embed.js.sha256](https://domaindrivenarchitecture.org/downloads/downloads/dda-masto-embed.js.sha256)
* [dda-masto-embed.js.sha512](https://domaindrivenarchitecture.org/downloads/downloads/dda-masto-embed.js.sha512)
* It is **OpenSource** - published under the Apache License, Version 2.0
In order to try it, just create a html like
```
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>masto-embed</title>
</head>
<body>
<div id="masto-embed"
account_name="team"
host_url="https://social.meissa-gmbh.de">
Here the timeline will appear.
</div>
<script src="https://domaindrivenarchitecture.org/downloads/dda-masto-embed.js"></script>
</body>
</html>
```
and you will get sth like:
![masto-embed-example.png](doc/masto-embed-example.png)
Styling is up to you atmo, help is welcome :-)
# Setup ## dev setup
``` ```
npm install -g npx npm install -g npx
npm install -g shadow-cljs npm install -g shadow-cljs
npm install -g source-map-support --save-dev npm install -g source-map-support --save-dev
npm install mastodon-api npm install
```
# Development
```
shadow-cljs watch frontend shadow-cljs watch frontend
``` ```
@ -23,8 +47,37 @@ open browser at http://localhost:8080
Connect your repl for :frontend Connect your repl for :frontend
# run the tests ## run the tests
``` ```
shadow-cljs compile test shadow-cljs compile test
``` ```
## releasing
### prod release
```
#adjust version
vi shadow-cljs.edn
git commit -am "releasing"
git tag [version]
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 -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 .
npm publish ./target/npm-build.tgz --access public
# Bump version
vi shadow-cljs.edn
git commit -am "version bump" && git push
```

BIN
doc/masto-embed-example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB