Skip to content

Commit

Permalink
ci: publish to npm & github release
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickshan committed May 27, 2024
1 parent 04f31b5 commit 093c70b
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 267 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Please make sure you are testing with the latest [release of html2canvas](https://github.com/yorickshan/html2canvas-pro/releases).
Please make sure you are testing with the latest [release of html2canvas-pro](https://github.com/yorickshan/html2canvas-pro/releases).
Old versions are not supported and issues reported for them will be closed.

# Please follow the general troubleshooting steps first:

- [ ] You are using the latest [version](https://github.com/yorickshan/html2canvas-pro/releases)
- [ ] You are testing using the non-minified version of html2canvas and checked any potential issues reported in the console
- [ ] You are testing using the non-minified version of html2canvas-pro and checked any potential issues reported in the console

<!-- You can erase any parts of this template not applicable to your Issue. -->

Expand All @@ -14,6 +14,6 @@ Please replace this line with a brief summary of your issue **AND** if possible

### Specifications:

* html2canvas version tested with:
* html2canvas-pro version tested with:
* Browser & version:
* Operating system:
145 changes: 16 additions & 129 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: CI

on:
push:
branches: [master]
branches: [main]
tags:
- 'v*'
pull_request:
branches: [master]
branches: [main]

jobs:
build:
Expand Down Expand Up @@ -36,13 +36,13 @@ jobs:
- name: Pack
run: |
npm pack
mv html2canvas-*.tgz html2canvas.tgz
tar --list --verbose --file=html2canvas.tgz
mv html2canvas-*.tgz html2canvas-pro.tgz
tar --list --verbose --file=html2canvas-pro.tgz
- name: Upload npm pack
uses: actions/upload-artifact@v3
with:
name: npm
path: html2canvas.tgz
path: html2canvas-pro.tgz
if-no-files-found: error
- name: Upload dist
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -189,35 +189,35 @@ jobs:
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ contains(github.ref, '-rc.') || contains(github.ref, '-alpha.') }}
- name: Upload html2canvas.js
- name: Upload html2canvas-pro.js
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/html2canvas.js
asset_name: html2canvas.js
asset_path: ./dist/html2canvas-pro.js
asset_name: html2canvas-pro.js
asset_content_type: text/javascript
- name: Upload html2canvas.min.js
- name: Upload html2canvas-pro.min.js
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/html2canvas.min.js
asset_name: html2canvas.min.js
asset_path: ./dist/html2canvas-pro.min.js
asset_name: html2canvas-pro.min.js
asset_content_type: text/javascript
- name: Upload html2canvas.esm.js
- name: Upload html2canvas-pro.esm.js
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/html2canvas.esm.js
asset_name: html2canvas.esm.js
asset_path: ./dist/html2canvas-pro.esm.js
asset_name: html2canvas-pro.esm.js
asset_content_type: text/javascript
- name: Unpack npm
run: cd npm && tar -xvzf "html2canvas.tgz"
run: cd npm && tar -xvzf "html2canvas-pro.tgz"
- uses: actions/setup-node@v3
with:
node-version: 16
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
name: dist
path: dist
- name: Unpack npm
run: cd npm && tar -xvzf "html2canvas.tgz"
run: cd npm && tar -xvzf "html2canvas-pro.tgz"
- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -256,116 +256,3 @@ jobs:
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
docs:
runs-on: ubuntu-latest
name: Build docs
needs: browser-test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Npm install
run: npm ci
- name: Download library
uses: actions/download-artifact@v3
with:
name: dist
path: www/static/dist
- name: Download test results
uses: actions/download-artifact@v3
with:
name: reftest-results
path: www/static/results
- name: Copy reftests to docs website
run: cp -R tests/reftests www/static/tests/reftests && cp -R tests/assets www/static/tests/assets && cp tests/test.js www/static/tests/test.js
- name: Create reftest result index
run: npm run build:reftest-result-list www/static/results/metadata www/src/results.json
- name: Create reftest previewer
run: npm run build:reftest-preview
- name: Clean metadata folder
run: rm -rf www/static/results/metadata
- name: Build docs
run: npm run build && cd www && npm install && npm run build && cd ..
- name: Upload docs
uses: actions/upload-artifact@v3
with:
name: docs
path: www/public
if-no-files-found: error
publish-docs:
runs-on: ubuntu-latest
name: Publish Docs
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
needs: docs
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Download docs
uses: actions/download-artifact@v3
with:
name: docs
path: docs
- name: Publish docs
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs
SINGLE_COMMIT: true
CLEAN: true
diff-reftests:
runs-on: ubuntu-latest
name: Diff reftest screenshots
needs: browser-test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Npm install
run: npm ci
- name: Checkout current snapshots
run: git checkout origin/gh-pages results
- name: Download test results
uses: actions/download-artifact@v3
with:
name: reftest-results
path: tmp/reftests
- name: Run diff
run: npm run reftests-diff
continue-on-error: true
- name: Upload diff
uses: actions/upload-artifact@v3
with:
name: snapshot-diffs
path: tmp/snapshot-diffs
Loading

0 comments on commit 093c70b

Please sign in to comment.