feat: new ui #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pr_test | |
on: | |
issue_comment: | |
types: [created] | |
# Allows to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
pr-test: | |
if: github.event.issue.pull_request | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check comment command | |
uses: actions-ecosystem/action-regex-match@v2 | |
id: regex-match | |
with: | |
text: ${{ github.event.comment.body }} | |
regex: '^/build-test$' | |
- uses: actions/github-script@v3 | |
id: get-pr | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
with: | |
script: | | |
const request = { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
} | |
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) | |
try { | |
const result = await github.pulls.get(request) | |
return result.data | |
} catch (err) { | |
core.setFailed(`Request failed with error ${err}`) | |
} | |
- name: Check out pull request head | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }} | |
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.sha }} | |
- name: Setup node 14 env | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
cache: "yarn" | |
- name: Build the website | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
run: | | |
git config --global url."https://github.com/".insteadOf git://github.com/ | |
yarn install | |
yarn run build | |
- name: Upload to OSS | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
uses: tvrcgo/upload-to-oss@master | |
with: | |
key-id: ${{ secrets.OSS_ACCESS_KEY_ID }} | |
key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }} | |
region: ${{ secrets.OSS_REGION }} | |
bucket: ${{ secrets.OSS_BUCKET }} | |
assets: | | |
./build/**:${{ secrets.OSS_TARGET_PATH }}${{ github.event.issue.number }}/ | |
- name: Create comment | |
if: ${{ steps.regex-match.outputs.match != '' }} | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: The website for this PR is deployed at https://open-galaxy.x-lab.info${{ secrets.OSS_TARGET_PATH }}${{ github.event.issue.number }}/ |