try to fix pr build
This commit is contained in:
parent
5847ff0b94
commit
9a99d99d30
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
@ -1,10 +1,10 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
on:
|
||||||
on: [push, pull_request]
|
- push
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: ${{ github.repository }}
|
IMAGE: ${{ github.repository }}
|
||||||
TAG: ${{ github.sha }}
|
VERSION: ${{ github.sha }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -21,7 +21,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
export VUE_APP_BUILD=$TAG
|
export VUE_APP_BUILD=$VERSION
|
||||||
export VUE_APP_BUILD_DATE=$(date --iso-8601)
|
export VUE_APP_BUILD_DATE=$(date --iso-8601)
|
||||||
yarn build
|
yarn build
|
||||||
|
|
||||||
@ -31,14 +31,26 @@ jobs:
|
|||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
|
build_docker_image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Build docker image
|
- name: Build docker image
|
||||||
run: docker build -t $IMAGE:$TAG -f docker/Dockerfile .
|
run: docker build -t $IMAGE:$VERSION -f docker/Dockerfile .
|
||||||
|
|
||||||
- name: Push docker image
|
- name: Push docker image
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
run: |
|
run: |
|
||||||
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
|
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
docker push $IMAGE:$TAG
|
docker push $IMAGE:$VERSION
|
||||||
|
|
||||||
preview:
|
preview:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -49,6 +61,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Deploy preview
|
- name: Deploy preview
|
||||||
uses: netlify/actions/cli@master
|
uses: netlify/actions/cli@master
|
||||||
@ -56,7 +69,7 @@ jobs:
|
|||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
with:
|
with:
|
||||||
args: deploy --dir=.
|
args: deploy --dir=dist
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -67,6 +80,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Deploy site
|
- name: Deploy site
|
||||||
uses: netlify/actions/cli@master
|
uses: netlify/actions/cli@master
|
||||||
@ -74,16 +88,16 @@ jobs:
|
|||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
with:
|
with:
|
||||||
args: deploy --dir=. --prod
|
args: deploy --dir=dist --prod
|
||||||
|
|
||||||
publish_docker_image:
|
publish_latest_docker_image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build_docker_image
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
steps:
|
steps:
|
||||||
- name: Push latest
|
- name: Push latest
|
||||||
run: |
|
run: |
|
||||||
docker pull $IMAGE:$TAG
|
docker pull $IMAGE:$VERSION
|
||||||
docker tag $IMAGE:$TAG $IMAGE:latest
|
docker tag $IMAGE:$VERSION $IMAGE:latest
|
||||||
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
|
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
docker push $IMAGE:latest
|
docker push $IMAGE:latest
|
||||||
|
28
.github/workflows/pr.yml
vendored
Normal file
28
.github/workflows/pr.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: PR
|
||||||
|
on:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
env:
|
||||||
|
VERSION: ${{ github.sha }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '12.x'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
export VUE_APP_BUILD=$VERSION
|
||||||
|
export VUE_APP_BUILD_DATE=$(date --iso-8601)
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
- name: Build docker image
|
||||||
|
run: docker build -t $IMAGE:$VERSION -f docker/Dockerfile .
|
Loading…
x
Reference in New Issue
Block a user