Skip to content

Commit

Permalink
Add github build action.
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Jul 10, 2023
1 parent 00e7baa commit 9d3598c
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Docker
on:
push:
tags:
- 'v*'
env:
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3

- name: Run pnpm
run: npm install -g pnpm && pnpm install && pnpm run build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to yiwen-ai registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.CR_REGISTRY }}
username: ${{ secrets.CR_USERNAME }}
password: ${{ secrets.CR_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.CR_REGISTRY }}/ywweb/webscraper
tags: |
type=semver,pattern={{raw}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# the available images at https://crawlee.dev/docs/guides/docker-images
# https://hub.docker.com/r/apify/actor-node-playwright-chrome/tags
FROM apify/actor-node-playwright-chrome:18-1.34.3-next
FROM apify/actor-node-playwright-chrome:20-1.35.1-beta

# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# webscraper
# webscraper

GET http://127.0.0.1:8080/scraping?url=https%3A%2F%2Fmp.weixin.qq.com%2Fs%2Felu0e-EdVkbdp3W68R7zLQ
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webscraper",
"version": "0.1.0",
"version": "0.2.0",
"description": "",
"private": true,
"main": "dist/main.js",
Expand Down Expand Up @@ -77,7 +77,8 @@
"koa": "^2.14.2",
"long": "^5.2.3",
"nanoid": "^4.0.2",
"playwright": "^1.35.1"
"playwright": "^1.35.1",
"zeed-dom": "0.10.5"
},
"devDependencies": {
"@types/config": "^3.3.0",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/tiptap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ export function parseHTMLDocument (html: string): {
html: string
} {
// writeFileSync('./debug/test-s.html', html, 'utf8')

// some error: "_a.startsWith is not a function"
// https://discuss.prosemirror.net/t/is-there-a-way-to-run-prosemirror-on-nodejs/2517/8
const jsonDoc = generateJSON(html, tiptapExtensions)
const amender = new JSONDocumentAmender()
const htmlDoc = generateHTML(amender.amendNode(jsonDoc as Node), tiptapExtensions)
Expand Down

0 comments on commit 9d3598c

Please sign in to comment.