mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-22 07:00:58 -05:00
Merge pull request #251 from brecert/actions-demo-test
This commit is contained in:
commit
2ff9c91287
5 changed files with 87 additions and 39 deletions
33
.github/actions/build/action.yml
vendored
Normal file
33
.github/actions/build/action.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
name: Build
|
||||||
|
description: Builds a project instance, assuming all the correct project files are in the build folder
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
base:
|
||||||
|
name: Base path
|
||||||
|
description: The path to use as a base for linking
|
||||||
|
required: true
|
||||||
|
default: /
|
||||||
|
folder:
|
||||||
|
name: Build Folder
|
||||||
|
description: The folder to try to build from
|
||||||
|
required: true
|
||||||
|
default: .
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 15
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- name: Install Dependencies and Build
|
||||||
|
shell: bash -l {0}
|
||||||
|
env:
|
||||||
|
BUILD_FOLDER: ${{ inputs.folder }}
|
||||||
|
BASE: ${{ inputs.base }}
|
||||||
|
run: |
|
||||||
|
cd "$BUILD_FOLDER"
|
||||||
|
yarn install
|
||||||
|
yarn build --base "$BASE"
|
10
.github/workflows/docker.yml
vendored
10
.github/workflows/docker.yml
vendored
|
@ -9,6 +9,7 @@ on:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/**"
|
- ".github/**"
|
||||||
- "!.github/workflows/docker.yml"
|
- "!.github/workflows/docker.yml"
|
||||||
|
- "!.github/workflows/preview_*.yml"
|
||||||
- ".vscode/**"
|
- ".vscode/**"
|
||||||
- ".gitignore"
|
- ".gitignore"
|
||||||
- ".gitlab-ci.yml"
|
- ".gitlab-ci.yml"
|
||||||
|
@ -17,6 +18,15 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
|
paths-ignore:
|
||||||
|
- ".github/**"
|
||||||
|
- "!.github/workflows/docker.yml"
|
||||||
|
- "!.github/workflows/preview_*.yml"
|
||||||
|
- ".vscode/**"
|
||||||
|
- ".gitignore"
|
||||||
|
- ".gitlab-ci.yml"
|
||||||
|
- "LICENSE"
|
||||||
|
- "README"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
7
.github/workflows/mirroring.yml
vendored
7
.github/workflows/mirroring.yml
vendored
|
@ -5,11 +5,10 @@ on: [push, delete]
|
||||||
jobs:
|
jobs:
|
||||||
to_gitlab:
|
to_gitlab:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
if: secrets.GITLAB_SSH_PRIVATE_KEY
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: pixta-dev/repository-mirroring-action@v1
|
- uses: pixta-dev/repository-mirroring-action@v1
|
||||||
with:
|
with:
|
||||||
target_repo_url:
|
target_repo_url: git@gitlab.com:insert/revolt-vite.git
|
||||||
git@gitlab.com:insert/revolt-vite.git
|
ssh_private_key: ${{ secrets.GITLAB_SSH_PRIVATE_KEY }}
|
||||||
ssh_private_key:
|
|
||||||
${{ secrets.GITLAB_SSH_PRIVATE_KEY }}
|
|
||||||
|
|
10
.github/workflows/preview_cleanup.yml
vendored
10
.github/workflows/preview_cleanup.yml
vendored
|
@ -1,8 +1,8 @@
|
||||||
name: Clean Preview
|
name: Clean Preview
|
||||||
|
|
||||||
#! Safety:
|
#! Safety:
|
||||||
#! this workflow should not execute any code at all
|
#! this workflow should not execute any untrusted input at all
|
||||||
#! see githubs docs on pull_request_target for more
|
#! see the docs on `pull_request_target` for more
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [unlabeled]
|
types: [unlabeled]
|
||||||
|
@ -11,6 +11,8 @@ jobs:
|
||||||
clean:
|
clean:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event.label.name == 'use-preview'
|
if: github.event.label.name == 'use-preview'
|
||||||
|
env:
|
||||||
|
BASE: refs/pull/${{ github.event.pull_request.number }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -19,14 +21,14 @@ jobs:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: clean previews
|
- name: clean previews
|
||||||
run: 'rm -rf "./refs/pull/${{ github.event.pull_request.number }}"'
|
run: rm -rf "$BASE"
|
||||||
|
|
||||||
- name: publish cleaned previews
|
- name: publish cleaned previews
|
||||||
uses: JamesIves/github-pages-deploy-action@4.1.5
|
uses: JamesIves/github-pages-deploy-action@4.1.5
|
||||||
with:
|
with:
|
||||||
folder: .
|
folder: .
|
||||||
branch: build-previews
|
branch: build-previews
|
||||||
single-commit: true
|
commit-message: "Cleaning up build result for #${{ github.event.pull_request.number }}"
|
||||||
|
|
||||||
- name: send comment
|
- name: send comment
|
||||||
uses: marocchino/sticky-pull-request-comment@v2
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
|
34
.github/workflows/preview_pull_request.yml
vendored
34
.github/workflows/preview_pull_request.yml
vendored
|
@ -1,41 +1,45 @@
|
||||||
name: Preview Pull Request
|
name: Preview Pull Request
|
||||||
|
|
||||||
|
#! Safety:
|
||||||
|
#! this workflow should not execute any untrusted input at all
|
||||||
|
#! see the docs on `pull_request_target` for more
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request_target:
|
||||||
types: [synchronize, reopened, labeled]
|
types: [synchronize, reopened, labeled]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
preview:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# make sure the pull request is labeled with 'use-preview'
|
# make sure the pull request is labeled with 'use-preview'
|
||||||
if: github.event.label.name == 'use-preview' || contains(github.event.pull_request.labels.*.name, 'use-preview')
|
if: github.event.label.name == 'use-preview' || contains(github.event.pull_request.labels.*.name, 'use-preview')
|
||||||
|
env:
|
||||||
|
BASE: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||||
|
REPO: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
# Head commit of the pull request
|
# Head commit of the pull request
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
path: pull
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: 15
|
|
||||||
cache: "yarn"
|
|
||||||
|
|
||||||
- run: yarn install
|
|
||||||
# - run: yarn check
|
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
run: yarn build --base "/revite/${{ github.ref }}/"
|
uses: ./.github/actions/build
|
||||||
|
with:
|
||||||
|
base: /${{ env.REPO }}/${{ env.BASE }}/
|
||||||
|
folder: pull
|
||||||
|
|
||||||
- name: publish preview
|
- name: publish preview
|
||||||
uses: JamesIves/github-pages-deploy-action@4.1.5
|
uses: JamesIves/github-pages-deploy-action@4.1.5
|
||||||
with:
|
with:
|
||||||
folder: dist
|
folder: pull/dist
|
||||||
branch: build-previews
|
branch: build-previews
|
||||||
target-folder: ${{ github.ref }}
|
target-folder: ${{ env.BASE }}
|
||||||
single-commit: true
|
single-commit: true
|
||||||
|
commit-message: "Publishing build result from #${{ github.event.pull_request.number }}"
|
||||||
|
|
||||||
- name: send comment
|
- name: send comment
|
||||||
uses: marocchino/sticky-pull-request-comment@v2
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
@ -43,6 +47,6 @@ jobs:
|
||||||
header: Preview environment
|
header: Preview environment
|
||||||
message: |
|
message: |
|
||||||
## Preview environment
|
## Preview environment
|
||||||
https://${{ github.repository_owner }}.github.io/revite/${{ github.ref }}/
|
https://${{ github.repository_owner }}.github.io/${{ env.REPO }}/${{ env.BASE }}/
|
||||||
|
|
||||||
This link will remain active until the `use-preview` label is removed.
|
This link will remain active until the `use-preview` label is removed.
|
||||||
|
|
Loading…
Reference in a new issue