88 lines
3.0 KiB
YAML
88 lines
3.0 KiB
YAML
run-name: Build push container image to GH
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
test:
|
|
uses: ./.github/workflows/_test.yml
|
|
permissions:
|
|
contents: read
|
|
secrets: inherit
|
|
|
|
build-and-push-to-ghcr:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
concurrency:
|
|
group: ${{ github.ref_type == 'branch' && github.ref }}
|
|
cancel-in-progress: true
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
lfs: true
|
|
submodules: true
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Set controller release version
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24.14.1
|
|
cache: npm
|
|
|
|
- name: npm install
|
|
run: npm ci
|
|
- name: get maxmind mmdb
|
|
run: mkdir -p licensed && curl -o licensed/GeoLite2-City.mmdb https://raw.githubusercontent.com/P3TERX/GeoLite.mmdb/download/GeoLite2-City.mmdb
|
|
- name: get asn mmdb
|
|
run: curl -o licensed/geolite2-asn.mmdb https://cdn.jsdelivr.net/npm/@ip-location-db/geolite2-asn-mmdb/geolite2-asn.mmdb
|
|
- name: get source han sans font
|
|
run: curl -o licensed/SourceHanSansSC-Regular.otf https://raw.githubusercontent.com/adobe-fonts/source-han-sans/refs/heads/release/OTF/SimplifiedChinese/SourceHanSansSC-Regular.otf
|
|
- name: get gsa user agent list
|
|
run: curl -o licensed/gsa_useragents.txt https://raw.githubusercontent.com/searxng/searxng/refs/heads/master/searx/data/gsa_useragents.txt
|
|
- name: build application
|
|
run: npm run build
|
|
- name: Set package version
|
|
run: npm version --no-git-tag-version ${{ env.RELEASE_VERSION }}
|
|
if: github.ref_type == 'tag'
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
ghcr.io/jina-ai/reader
|
|
labels: |
|
|
org.opencontainers.image.created={{timestamp}}
|
|
org.opencontainers.image.source="https://github.com/jina-ai/reader"
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=ref,event=pr
|
|
type=raw,value=oss,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
|
flavor: |
|
|
latest=true
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|