-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
an automated quick commit and push (tpush)
- Loading branch information
1 parent
21c757e
commit 0b9198f
Showing
1 changed file
with
23 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
name: Deploy to t-ibrahimm.github.io | ||
# This workflow runs on push to the master branch. | ||
# It checks out the code from the current repo (machine-moon/t-website), | ||
# then copies everything into a fresh repo for t-ibrahimm/t-ibrahimm.github.io | ||
# Finally, it commits and pushes those changes to the backup repo. | ||
|
||
name: DeployMirror | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
- name: Check out source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build project | ||
run: npm run build | ||
- name: Configure Git | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
- name: Deploy to GitHub Pages | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TARGET_REPO_TOKEN }} | ||
- name: Mirror to backup repo | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git clone --branch gh-pages https://github.com/t-ibrahimm/t-ibrahimm.github.io.git deploy | ||
rsync -av --delete dist/ deploy/ | ||
cd deploy | ||
# Make a directory for the backup repo. | ||
mkdir ../backup | ||
cp -R . ../backup | ||
cd ../backup | ||
# Initialize and push to the backup repo (force for simplicity). | ||
git init | ||
git remote add origin https://x-access-token:${{ secrets.MY_TOKEN }}@github.com/t-ibrahimm/t-ibrahimm.github.io.git | ||
git add . | ||
git commit -m "Deploy from mainaccount:machine-moon/t-website" | ||
git push origin gh-pages | ||
git commit -m "Mirror from machine-moon/t-website" | ||
git push origin master --force |