diff --git a/.github/workflows/git-pr.yml b/.github/workflows/git-pr.yml new file mode 100644 index 00000000..02f2d16c --- /dev/null +++ b/.github/workflows/git-pr.yml @@ -0,0 +1,37 @@ +name: git pull_request into another repo to deploy to vercel + +on: + pull_request: + branches: + - main + - develop + +jobs: + if_merged: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + container: pandoc/latex + steps: + - uses: actions/checkout@v2 + - name: Install mustache (to update the date) + run: apk add ruby && gem install mustache + - name: creates output + run: sh ./build.sh + - name: Delete .github directory + run: | + cd ./output + rm -rf .github + - name: Pushes to another repository + id: push_directory + uses: cpina/github-action-push-to-another-repository@main + env: + API_TOKEN_GITHUB: ${{ secrets.JOBIS_GITHUB_TOKEN }} + with: + source-directory: 'output' + destination-github-username: teamreturn + destination-repository-name: JOBIS-FE + user-email: ${{ secrets.RETURN_ACCOUNT_EMAIL }} + commit-message: ${{ github.event.commits[0].message }} + target-branch: ${{ github.base_ref }} + - name: Test get variable exported by push-to-another-repository + run: echo $DESTINATION_CLONED_DIRECTORY diff --git a/.github/workflows/git-push.yml b/.github/workflows/git-push.yml index 945c1bd6..66719e6b 100644 --- a/.github/workflows/git-push.yml +++ b/.github/workflows/git-push.yml @@ -2,6 +2,9 @@ name: git push into another repo to deploy to vercel on: push: + branches: + - main + - develop jobs: build: @@ -13,6 +16,10 @@ jobs: run: apk add ruby && gem install mustache - name: creates output run: sh ./build.sh + - name: Delete .github directory + run: | + cd ./output + rm -rf .github - name: Pushes to another repository id: push_directory uses: cpina/github-action-push-to-another-repository@main diff --git a/build.sh b/build.sh index bb1bdd68..0b960c3b 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,6 @@ #!/bin/sh cd ../ mkdir output -cp -R ./JOBIS-FE/* ./output +cp -R ./JOBIS-FE/. ./output cp -R ./output ./JOBIS-FE/ +