|
| 1 | +# React-Redux App Build CI ... jobs: 1) greeting 2) deploying project to GitHub Pages |
| 2 | +# ---------------------------------------------------------------------------------- |
| 3 | + |
| 4 | +name: React_App_Deploy_to_gh-pages_CI |
| 5 | +env: |
| 6 | + APPLICATION_NAME: 'App Deploy CI' |
| 7 | + DEPLOY_PACKAGE_NAME: 'rap-v-${{ github.sha }}' |
| 8 | + MY_REPO: ${{github.repository}}.git |
| 9 | + |
| 10 | + |
| 11 | +on: |
| 12 | + pull_request: |
| 13 | + branches: [ master ] |
| 14 | + watch: |
| 15 | + types: [started] |
| 16 | + |
| 17 | +jobs: |
| 18 | + greeting: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + if: github.actor == github.event.repository.owner.login |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Greeting |
| 25 | + run: | |
| 26 | + echo 'Hi guys ...' |
| 27 | + echo 'we just try to Deploy our React-Redux-SPA ... ${{env.APPLICATION_NAME}}' |
| 28 | + echo 'with version: ${{env.DEPLOY_PACKAGE_NAME}}' |
| 29 | + deploying: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + needs: [greeting] |
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + node-version: [14.x] |
| 35 | + steps: |
| 36 | + |
| 37 | + - name: Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 38 | + uses: actions/checkout@v2 |
| 39 | + |
| 40 | + - name: Use Node.js version ... ${{ matrix.node-version }} |
| 41 | + uses: actions/setup-node@v1 |
| 42 | + with: |
| 43 | + node-version: ${{ matrix.node-version }} |
| 44 | + |
| 45 | + - name: Install Packages (npm ci) ... It will never write to package.json or any of the package-locks, installs are essentially frozen |
| 46 | + run: npm install |
| 47 | + |
| 48 | + - name: List current folder ... before |
| 49 | + run: ls -la |
| 50 | + |
| 51 | + - name: NPM Version |
| 52 | + run: npm -v |
| 53 | + |
| 54 | + - name: Node Version |
| 55 | + run: node -v |
| 56 | + |
| 57 | + - name: Deploy project to GitHub Pages |
| 58 | + run: | |
| 59 | + echo 'Git Repo: ${{env.MY_REPO}}' |
| 60 | + git config --global user.email ${{secrets.MY_SECRET_EMAIL}} |
| 61 | + git config --global user.name ${{secrets.MY_SECRET_USERNAME}} |
| 62 | + git remote set-url origin https://${{secrets.MY_SECRET_PERSONAL_ACCESS_TOKEN}}@github.com/${{env.MY_REPO}} |
| 63 | + npm run deploy |
| 64 | + - name: List current folder ... after |
| 65 | + run: ls -la |
| 66 | + |
| 67 | + - name: Updating Domain ... (SELECT gh-pages branch to publish) |
| 68 | + run: echo 'Update domain - GitHub Pages (SELECT gh-pages branch to publish)' |
| 69 | + |
| 70 | + env: |
| 71 | + CI: true |
0 commit comments