Configure Renovate #9
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 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Get npm cache directory | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- 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\//}" | |
content="${content//$\:\/themes\//}" | |
# replace plugin-type with pluginType | |
content="${content//$'plugin-type'/'pluginType'}" | |
# end of optional handling for multi line json | |
echo "::set-output name=pluginInfoJSON::$content" | |
- name: Install dependencies | |
run: pnpm 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/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).pluginType}}s/${{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 |