Created
October 14, 2023 15:35
-
-
Save sadiqsalau/d7398c5998f6d7f576a3fc597daba921 to your computer and use it in GitHub Desktop.
Deploy React to another Repository
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: "Build and Deploy" | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [node] | |
steps: | |
# Build | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm run build | |
# Deploy | |
- name: Deploy | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
with: | |
user-email: | |
create-target-branch-if-needed: true | |
source-directory: "dist" | |
destination-github-username: ${{ secrets.DEPLOY_GITHUB_USERNAME }} | |
destination-repository-name: ${{ secrets.DEPLOY_GITHUB_REPO }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment