Skip to content

高级聚合搜索,多关键字 #3

高级聚合搜索,多关键字

高级聚合搜索,多关键字 #3

name: Build and push
on: [] # disable this for now
# push:
# branches-ignore:
# - "dependabot/**"
# tags:
# - v*
jobs:
build-artifacts:
name: Build and upload SPA and PWA artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install -g @quasar/cli && npm ci
# Note: we don't have any unit tests yet
# Only ESLint is available, which is integrated into quasar.conf.js
- name: Build SPA and PWA
run: quasar build && quasar build -m pwa
# Convert to a valid filename
# refs/tags/v1.2.3 => v1.2.3
# refs/heads/unstable => unstable
# refs/heads/feature/foo => foo
# refs/pull/421/merge => merge
- name: Get branch or tag name
id: source_name
run: echo ::set-output name=SOURCE_NAME::${GITHUB_REF##*/}
- name: 'Upload artifact: SPA'
uses: actions/upload-artifact@v2
with:
name: SPA-${{ steps.source_name.outputs.SOURCE_NAME }}
path: dist/spa/
- name: 'Upload artifact: PWA'
uses: actions/upload-artifact@v2
with:
name: PWA-${{ steps.source_name.outputs.SOURCE_NAME }}
path: dist/pwa/
- name: Create Gzips for release
if: startsWith(github.ref, 'refs/tags/')
run: cd dist/ && tar -czvf spa-${GITHUB_REF##*/}.tar.gz spa/ && tar -czvf pwa-${GITHUB_REF##*/}.tar.gz pwa/
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
dist/spa-${{ steps.source_name.outputs.SOURCE_NAME }}.tar.gz
dist/pwa-${{ steps.source_name.outputs.SOURCE_NAME }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-push:
name: Publish docker images to Docker Hub
if: contains(fromJson('["refs/heads/unstable", "refs/tags/", "refs/heads/stable"]'), github.ref)
# Note: we don't have any unit tests yet
# Only ESLint is available, which is integrated into quasar.conf.js
# Prevent execution of docker job if the linter fails
needs: build-artifacts
runs-on: ubuntu-18.04
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU for cross platform builds
id: qemu
uses: docker/setup-qemu-action@v1
- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Convert to a valid docker tagname
# refs/tags/v1.2.3 => v1.2.3
# refs/heads/unstable => unstable
# refs/heads/feature/foo => foo
# refs/pull/421/merge => merge
- name: Get branch or tag name
id: source_name
run: echo ::set-output name=SOURCE_NAME::${GITHUB_REF##*/}
- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
muveex/kikoeru-quasar:${{ steps.source_name.outputs.SOURCE_NAME }}
muveex/kikoeru-quasar:dev
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Temp fix according to official document at
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#registry-cache
# They are working to refactor with GitHub cache backend
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache