Skip to content

Commit 5e7eff0

Browse files
committed
Try uploading the files to GH CDN
1 parent 6d70534 commit 5e7eff0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and publish
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
Upload-ECF-Submission:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-node@v3
11+
with:
12+
node-version: 16
13+
- name: Create PR for file artifacts
14+
run: |
15+
TARGET_REPO="https://x-access-token:${{ secrets.TARGET_REPO_TOKEN }}@github.com/armhil/armhil.github.io.git"
16+
# Clone the target repository into a folder named "target-repo"
17+
git config --global user.email "arman.hilmioglu@gmail.com"
18+
git config --global user.name "armhil"
19+
git clone "$TARGET_REPO" target-repo
20+
cd target-repo
21+
# Create a new branch with a timestamp-based name
22+
BRANCH="add-ecf-submission-artifacts-$(date +%s)"
23+
git checkout -b "$BRANCH"
24+
# Copy build artifacts from current workspace into the target repo folder
25+
cp -R ../docs/* ./easy-code-formatter/documents/
26+
cp -R ../docs/images/* ./easy-code-formatter/images/
27+
cp -R ../docs/icons/* ./easy-code-formatter/icons/
28+
git add .
29+
# Check if there are staged changes
30+
if git diff --staged --quiet; then
31+
echo "No changes to commit. Exiting."
32+
exit 0
33+
else
34+
git commit -m "Add file artifacts from ecf submission"
35+
git push origin "$BRANCH"
36+
# Authenticate GitHub CLI using the secret token
37+
echo "${{ secrets.TARGET_REPO_TOKEN }}" | gh auth login --with-token
38+
# Create a pull request targeting the main branch
39+
gh pr create --title "Add file artifacts from ecf submission" --body "This PR includes the latest file artifacts from ecf submission." --base main
40+
fi

0 commit comments

Comments
 (0)