Merge pull request #1065 from pietervdvn/preview_comment

chore(pr): add a preview comment on PR if they are previewable
This commit is contained in:
Pieter Vander Vennet 2022-09-05 11:56:42 +02:00 committed by GitHub
commit b23ddf5515
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -1,6 +1,5 @@
name: Deployment on pietervdvn name: Deployment on pietervdvn
on: on: push
push
jobs: jobs:
build: build:
@ -28,13 +27,15 @@ jobs:
cd pietervdvn.github.io cd pietervdvn.github.io
git pull git pull
- name: get branch name
run: echo TARGET_BRANCH=${GITHUB_REF:11} >> $GITHUB_ENV
- name: "Copying files" - name: "Copying files"
run: | run: |
echo "Deploying" echo "Deploying"
TARGET=${GITHUB_REF:11} rm -rf pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}/*
rm -rf pietervdvn.github.io/mc/$TARGET/* mkdir -p pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}/
mkdir -p pietervdvn.github.io/mc/$TARGET/ cp -r dist/* pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}/
cp -r dist/* pietervdvn.github.io/mc/$TARGET/
cd pietervdvn.github.io/ cd pietervdvn.github.io/
git add * git add *
if git status | grep -q "Changes to be committed" if git status | grep -q "Changes to be committed"
@ -44,3 +45,13 @@ jobs:
else else
echo "No changes to commit" echo "No changes to commit"
fi fi
env:
TARGET_BRANCH: ${{ env.TARGET_BRANCH }}
- uses: mshick/add-pr-comment@v1
name: Comment the PR with the review URL
if: ${{ success() && github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/master' }}
with:
message: |
[🚀 Preview Branch](https://pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }})
repo-token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -28,8 +28,6 @@ cp -r assets/svg/ dist/assets/svg/
cp -r assets/tagRenderings/ dist/assets/tagRenderings/ cp -r assets/tagRenderings/ dist/assets/tagRenderings/
cp assets/*.png dist/assets/ cp assets/*.png dist/assets/
cp assets/*.svg dist/assets/ cp assets/*.svg dist/assets/
cp assets/generated/*.png dist/assets/generated/
cp assets/generated/*.svg dist/assets/generated/
SRC_MAPS="--no-source-maps" SRC_MAPS="--no-source-maps"
BRANCH=`git rev-parse --abbrev-ref HEAD` BRANCH=`git rev-parse --abbrev-ref HEAD`