Enhance sync with upstream and push for almalinux/docker-library-official-images (#6)

- use GitHub CLI to sync
- pull with '--rebase --autostash' before push

Update README.md
This commit is contained in:
Yuriy Kohut 2024-04-12 14:22:02 +03:00 committed by GitHub
parent 926f2d68e6
commit 1595870d6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 25 deletions

View File

@ -108,6 +108,14 @@ jobs:
- prepare-definitions
steps:
-
name: "Sync ${{ env.local_library }} with ${{ env.docker_library }}, branch 'master'"
run: |
# Sync ${{ env.local_library }} with ${{ env.docker_library }}, branch 'master'
gh auth login --with-token < <(echo ${{ secrets.GIT_HUB_TOKEN }})
gh repo sync ${{ env.local_library }} --force --source ${{ env.docker_library }} --branch master
-
name: Checkout ${{ env.local_library }}, branch 'master'
uses: actions/checkout@v4
@ -117,27 +125,6 @@ jobs:
token: ${{ secrets.GIT_HUB_TOKEN }}
fetch-depth: 0 # Checkout all commits
-
name: "Sync ${{ env.local_library }} with ${{ env.docker_library }}"
run: |
# sync ${{ env.local_library }}
cd official-images
git remote add upstream https://github.com/${{ env.docker_library }}.git
git fetch upstream
git checkout master
ret=0
git rebase upstream/master || ret=$?
if [ $ret -ne 0 ]; then
echo "Abort the rebase, reset last commit, stash it and try to rebase again ..."
git rebase --abort
git reset HEAD~1
git stash
git rebase upstream/master
fi
# Download uploaded above 'official-images/library/almalinux.*'
- uses: actions/download-artifact@v4
name: Download all definitions
@ -194,7 +181,8 @@ jobs:
with:
cwd: official-images
default_author: user_info
message: "Almalinux auto-update - ${{ env.date_stamp }} ${{ env.time_stamp }}"
pull: '--rebase --autostash'
message: "AlmaLinux auto-update - ${{ env.date_stamp }} ${{ env.time_stamp }}"
push: true
-

View File

@ -660,7 +660,7 @@ Publish images to the Docker Library
└── Create Pull Request with the new definition file
├── Set up job
├── Checkout official-images, branch 'master'
├── Sync official-images with docker-library/official-images
├── Sync official-images with docker-library/official-images, branch 'master'
├── Download all definitions
├── Create head of official-images/library/almalinux
├── Merge definitions into official-images/library/almalinux
@ -721,7 +721,7 @@ That's your fork of [docker-library/official-images](https://github.com/docker-l
#### Step: Sync *official-images* with upstream
The step is written in bash. It adds the [official-images upstream](https://github.com/docker-library/official-images) repository, sets a local 'master' branch to track the corresponding one from the upstream, and tries to rebase with the 'upstream/master'.
The step is written in bash. It uses GitHub CLI to sync the [docker-library-official-images](https://github.com/AlmaLinux/docker-library-official-images) with the [official-images upstream](https://github.com/docker-library/official-images) repository.
#### Step: Download all definitions
@ -749,8 +749,9 @@ Uses [EndBug/add-and-commit@v9](https://github.com/marketplace/actions/add-commi
The commit message is:
```yaml
Almalinux auto-update - ${{ env.date_stamp }} ${{ env.time_stamp }}.
AlmaLinux auto-update - ${{ env.date_stamp }} ${{ env.time_stamp }}.
```
> It will try to pull recent changes (before push) with `--rebase --autostash`
#### Step: Create Pull Request for *official-images/library/almalinux*