name: Build and Deploy on: push: branches: ["slave"] pull_request: branches: ["slave"] jobs: deploy: environment: github-pages runs-on: ubuntu-latest permissions: contents: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} outputs: DATEMODIFIED_CODE_DEPLOYMENT: ${{ steps.output_actions_gh_pages.outputs.DATEMODIFIED_CODE_DEPLOYMENT }} steps: - uses: actions/checkout@v3 - name: Install dependencies run: npm install - name: Build run: npm run build:canary - name: Read Build Timestamped Env from .env FILE generated id: set_modified_timestamped_actions_gh_pages run: | echo "DATEMODIFIED_CODE_DEPLOYMENT=$(cat .env | grep DATEMODIFIED_CODE_DEPLOYED | cut -d '=' -f2)" >> $GITHUB_ENV - name: deploy to gh-pages uses: peaceiris/actions-gh-pages@v3 with: deploy_key: ${{ secrets.DEPLOY_KEY }} publish_dir: ./build - name: output the output variable id: output_actions_gh_pages run: echo "DATEMODIFIED_CODE_DEPLOYMENT=${{ env.DATEMODIFIED_CODE_DEPLOYMENT }}" >> "$GITHUB_OUTPUT" alert_code_change: runs-on: ubuntu-latest needs: deploy environment: github-pages if: github.event_name == 'push' || github.event_name == 'pull_request' steps: - name: Access the output variable from the deploy job run: echo "DATEMODIFIED_CODE_DEPLOYMENT=${{ needs.deploy.outputs.DATEMODIFIED_CODE_DEPLOYMENT }}" - name: Access the output variable form two run: echo "${{ env.DATEMODIFIED_CODE_DEPLOYMENT }}" - name: Access the output variable form three run: echo $GITHUB_OUTPUT - name: Emit repository_dispatch event to canary heartbeat uses: mvasigh/dispatch-action@main with: # You should create a personal access token and store it in your repository token: ${{ secrets.LICENSE_TO_DISPATCH_NOTIFY }} repo: react-adobe-embed-cd-canary owner: ZIPING-LIU-CORPORATION event_type: react_adobe_embed_code_pushed message: | { "DATEMODIFIED_CODE_DEPLOYED" : "${{ env.DATEMODIFIED_CODE_DEPLOYMENT}}" } env: DATEMODIFIED_CODE_DEPLOYMENT: ${{ needs.deploy.outputs.DATEMODIFIED_CODE_DEPLOYMENT }}