v0.2.8 #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
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: Get npm cache directory | |
uses: actions/cache@v3 | |
with: | |
path: ~/.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 i | |
- name: Make Plugins | |
run: npm run make | |
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 }' | |
- 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: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: ./dist/output | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |