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
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
- push
|
||||
|
||||
env:
|
||||
IMAGE: ${{ github.repository }}
|
||||
TAG: ${{ github.sha }}
|
||||
VERSION: ${{ github.sha }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export VUE_APP_BUILD=$TAG
|
||||
export VUE_APP_BUILD=$VERSION
|
||||
export VUE_APP_BUILD_DATE=$(date --iso-8601)
|
||||
yarn build
|
||||
|
||||
@ -31,14 +31,26 @@ jobs:
|
||||
name: 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
|
||||
run: docker build -t $IMAGE:$TAG -f docker/Dockerfile .
|
||||
run: docker build -t $IMAGE:$VERSION -f docker/Dockerfile .
|
||||
|
||||
- name: Push docker image
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
run: |
|
||||
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
docker push $IMAGE:$TAG
|
||||
docker push $IMAGE:$VERSION
|
||||
|
||||
preview:
|
||||
runs-on: ubuntu-latest
|
||||
@ -49,6 +61,7 @@ jobs:
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
- name: Deploy preview
|
||||
uses: netlify/actions/cli@master
|
||||
@ -56,7 +69,7 @@ jobs:
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
with:
|
||||
args: deploy --dir=.
|
||||
args: deploy --dir=dist
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
@ -67,6 +80,7 @@ jobs:
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
- name: Deploy site
|
||||
uses: netlify/actions/cli@master
|
||||
@ -74,16 +88,16 @@ jobs:
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
with:
|
||||
args: deploy --dir=. --prod
|
||||
args: deploy --dir=dist --prod
|
||||
|
||||
publish_docker_image:
|
||||
publish_latest_docker_image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
needs: build_docker_image
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- name: Push latest
|
||||
run: |
|
||||
docker pull $IMAGE:$TAG
|
||||
docker tag $IMAGE:$TAG $IMAGE:latest
|
||||
docker pull $IMAGE:$VERSION
|
||||
docker tag $IMAGE:$VERSION $IMAGE:latest
|
||||
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
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