Deploying AIO preview to another Github repository #1
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
# This workflow runs whenever the AIO build workflow has completed. Deployment happens | |
# as part of a dedicated second workflow to avoid security issues where the building would | |
# otherwise occur in an authorized context where secrets could be leaked. | |
# | |
# More details can be found here: | |
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. | |
name: Deploying AIO preview to another Github repository | |
on: | |
workflow_run: | |
workflows: [ 'Build AIO app for preview deployment' ] | |
types: [ completed ] | |
jobs: | |
aio-deploy: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Download Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: aio | |
path: ./dist/bin/aio/build | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: Clone Another Repository | |
run: | | |
git clone https://github.com/ng-docs/angular.en.git deploy-repo | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Copy Artifact | |
run: cp -r ./dist/bin/aio/build deploy-repo | |
- name: Commit and Push | |
run: | | |
cd deploy-repo | |
git add . | |
git commit -m "Deploy latest artifact" | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |