Skip to content

v1.0.0

v1.0.0 #44

Workflow file for this run

name: Release Plugins
on:
push:
tags:
- 'v*.*.*'
paths-ignore:
- 'README.md'
- 'docs/**'
- '.vscode'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
- '.vscode'
concurrency:
group: release-ci-group
cancel-in-progress: true
jobs:
Plugins:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- id: setPluginInfoJSON
run: |
content=`cat ./src/plugin.info`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# here we replace "title": "$:/plugins/linonetwo/tw-example-plugin", to "title": "linonetwo/tw-example-plugin",
# so it can be used in tiddly-gittly/tw5-plugin-packer to find output path
content="${content//$\:\/plugins\//}"
# end of optional handling for multi line json
echo "::set-output name=pluginInfoJSON::$content"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
~/.pnpm-store
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-node-
- name: Install Dependencies
run: npm install -g pnpm && pnpm install
- name: Make Plugins
run: pnpm run make && pnpm run download-react
env:
CI: true
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# this should be the same as `scripts/run-action.mjs`
- uses: tiddly-gittly/[email protected]
with:
minify: 'true'
# here we read plugin author and name from pluginInfoJSON, and pluginInfoJSON is read in the step above with id `setPluginInfoJSON`
source: 'dist/plugins/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).title}}'
output: 'dist/out'
uglifyjs-options: '{ "warnings": false, "ie8": false, "safari10": false }'
cleancss-options: '{ "compatibility": "*", "level": 2 }'
# build dev channel
- uses: tiddly-gittly/[email protected]
with:
minify: 'true'
# here we read plugin author and name from pluginInfoJSON, and pluginInfoJSON is read in the step above with id `setPluginInfoJSON`
source: 'dist/plugins/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).title}}-dev'
output: 'dist/out-dev'
uglifyjs-options: '{ "warnings": false, "ie8": false, "safari10": false }'
cleancss-options: '{ "compatibility": "*", "level": 2 }'
- name: mv dev to output
run: npx zx ./scripts/mv-dev.mjs
- name: Make Demo Site
run: npx zx ./scripts/build-demo-html.mjs
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/out/*.json
dist/out/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# location is described in ./scripts/build-demo-html.mjs
publish_dir: ./dist/output