diff --git a/.github/workflows/release.yml b/.github/workflows/build.yml similarity index 89% rename from .github/workflows/release.yml rename to .github/workflows/build.yml index 08686b1..147e550 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,9 @@ -name: release prod -on: +name: build-it push: - tags: '[0-9]+.[0-9]+.[0-9]+*' jobs: - release: - name: release + build-it: + name: build-it runs-on: ubuntu-latest strategy: matrix: @@ -40,12 +38,14 @@ jobs: shadow-cljs compile test - name: build em + if: ${{ github.branch == 'master' }} run: | shadow-cljs release lib sha256sum target/lib.js > target/dda-masto-embedd.js.sha256 sha512sum target/lib.js > target/dda-masto-embedd.js.sha512 - name: Create Release + if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }} id: create_release uses: actions/create-release@v1 env: @@ -57,6 +57,7 @@ jobs: prerelease: false - name: Upload masto-embedd.js + if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }} id: upload-masto-embedd-js uses: actions/upload-release-asset@v1 env: @@ -68,6 +69,7 @@ jobs: asset_content_type: application/json - name: Upload masto-embedd.js.sha256 + if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }} id: upload-masto-embedd-js-sha256 uses: actions/upload-release-asset@v1 env: @@ -79,6 +81,7 @@ jobs: asset_content_type: application/json - name: Upload masto-embedd.js.sha512 + if: ${{ github.tag == '[0-9]+.[0-9]+.[0-9]+' }} id: upload-masto-embedd-js-sha512 uses: actions/upload-release-asset@v1 env: @@ -90,6 +93,7 @@ jobs: asset_content_type: application/json - name: upload to npm + if: ${{ github.branch == 'master' }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: | @@ -99,5 +103,6 @@ jobs: cp target/dda-masto-embedd.js.sha512 target/npm-build/ cp package.json 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 . npm publish ./target/npm-build.tgz --access public diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml deleted file mode 100644 index d736100..0000000 --- a/.github/workflows/test-pr.yml +++ /dev/null @@ -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 diff --git a/README.md b/README.md index 9882259..5b424ea 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,44 @@ # 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 +``` + + + + + masto-embed + + +
+ Here the timeline will appear. +
+ + + +``` + +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 shadow-cljs npm install -g source-map-support --save-dev -npm install mastodon-api - -``` - -# Development - -``` +npm install shadow-cljs watch frontend ``` @@ -23,8 +47,37 @@ open browser at http://localhost:8080 Connect your repl for :frontend -# run the tests +## run the tests ``` 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 +``` \ No newline at end of file diff --git a/doc/masto-embed-example.png b/doc/masto-embed-example.png new file mode 100644 index 0000000..0d38fa3 Binary files /dev/null and b/doc/masto-embed-example.png differ