-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e85c1d4
commit 2b2ee1f
Showing
1 changed file
with
9 additions
and
45 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 |
---|---|---|
|
@@ -11,8 +11,7 @@ on: | |
types: | ||
- completed | ||
workflow_call: | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
@@ -26,7 +25,7 @@ jobs: | |
fetch-depth: 0 | ||
# Ensure detached HEAD state to avoid conflicts with the main branch | ||
ref: refs/heads/main | ||
|
||
- name: Download a Build Artifact Version | ||
uses: dawidd6/[email protected] | ||
with: | ||
|
@@ -58,49 +57,14 @@ jobs: | |
name: build | ||
path: ./build/ | ||
|
||
|
||
- name: List contents of the build directory | ||
run: | | ||
echo "Contents of the build directory:" | ||
ls -al ./build/ | ||
- name: Configure git | ||
- name: Create and switch to a temporary deployment branch | ||
run: | | ||
git config --global user.name ' github-actions[bot]' | ||
git config --global user.email ' github-actions[bot]@users.noreply.github.com' | ||
git checkout -b temp-deploy-branch-$VERSION | ||
- name: Clone GitHub Pages repository | ||
env: | ||
PERSONAL_ACCESS_TOKEN: ${{ secrets.SECRET_TO_PUSH_TO_CIROH_GITHUB_IO }} | ||
run: | | ||
git clone --single-branch --branch main https://ciroh-ua:${{ secrets.SECRET_TO_PUSH_TO_CIROH_GITHUB_IO }}@github.com/CIROH-UA/ciroh-ua.github.io.git gh-pages | ||
rsync -av --delete-after ./build/ gh-pages/ # Copy the contents of the build directory | ||
git checkout -b deploy-branch-$VERSION | ||
git add . | ||
git commit -m "Deploy from CI workflow artifact" | ||
- name: Push changes to new branch | ||
working-directory: gh-pages | ||
env: | ||
PERSONAL_ACCESS_TOKEN: ${{ secrets._PAT_SECRET }} | ||
run: | | ||
git remote add target https://github.com/CIROH-UA/ciroh-ua.github.io.git | ||
git push --set-upstream target deploy-branch-$VERSION | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
token: ${{ secrets.SECRET_TO_PUSH_TO_CIROH_GITHUB_IO }} | ||
commit-message: "Deploy from CI workflow artifact" | ||
branch: deploy-branch-$VERSION | ||
title: "Deploy from CI" | ||
body: "This is an automated PR to deploy changes from CI workflow." | ||
base: main | ||
|
||
# - name: Commit and push changes | ||
# working-directory: gh-pages | ||
# run: | | ||
# git add . | ||
# git commit -m "Deploy from CI workflow artifact" || echo "Nothing to commit" | ||
# git push --set-upstream origin main | ||
|
||
branch: main | ||
folder: build | ||
repository-name: CIROH-UA/ciroh-ua.github.io |