Update .forgejo/workflows/package-check.yml
This commit is contained in:
parent
76d0a913ac
commit
4f1cc6bd36
1 changed files with 10 additions and 7 deletions
|
@ -17,19 +17,22 @@ jobs:
|
|||
COMMIT_AUTHOR_NAME: "forgejo-runner"
|
||||
COMMIT_AUTHOR_EMAIL: "forgejo-runner@shork.ch"
|
||||
COMMIT_MESSAGE: "Update build metadata"
|
||||
GET_NEWEST_VERSION_CMD: "curl https://api.github.com/repos/monero-project/monero/tags | jq -r .[0].name"
|
||||
GIT_REPO_URL: "https://github.com/monero-project/monero"
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
apk add --no-cache git bash jq nodejs npm curl
|
||||
echo "Run because of ${{ github.event_name }}"
|
||||
apk add --no-cache git nodejs npm bash sed curl $PACKAGE
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get latest package version
|
||||
id: check
|
||||
run: |
|
||||
newest_version=$(curl https://api.github.com/repos/monero-project/monero/tags | jq -r .[0].name)
|
||||
newest_version=$(eval "$GET_NEWEST_VERSION_CMD")
|
||||
echo "NEWEST_VERSION=$newest_version" >> $GITHUB_ENV
|
||||
|
||||
- name: Determine if update is needed
|
||||
|
@ -43,7 +46,7 @@ jobs:
|
|||
current_day=$(( $(date +%s) / 86400 ))
|
||||
|
||||
update="false"
|
||||
if [ "$last_version" != "$NEWEST_VERSION" ] || [ $((current_day - last_rebuild)) -gt 14 ]; then
|
||||
if [ ${{ github.event_name }} == "workflow_dispatch" ] || [ "$last_version" != "$NEWEST_VERSION" ] || [ $((current_day - last_rebuild)) -gt 14 ]; then
|
||||
update="true"
|
||||
fi
|
||||
|
||||
|
@ -64,7 +67,7 @@ jobs:
|
|||
- name: Build and push Docker image
|
||||
if: env.UPDATE == 'true'
|
||||
run: |
|
||||
git clone https://github.com/monero-project/monero ../$PACKAGE
|
||||
git clone $GIT_REPO_URL ../$PACKAGE
|
||||
cd ../$PACKAGE
|
||||
git fetch --all --tags
|
||||
git checkout tags/$NEWEST_VERSION
|
||||
|
@ -72,14 +75,14 @@ jobs:
|
|||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login $DOCKER_REGISTRY -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
docker push $DOCKER_REGISTRY/$REGISTRY_USER/docker-$PACKAGE:latest
|
||||
cd
|
||||
echo "$NEWEST_VERSION" > .last_version
|
||||
echo $(( $(date +%s) / 86400 )) > .last_rebuild
|
||||
|
||||
- name: Commit updated metadata
|
||||
if: env.UPDATE == 'true'
|
||||
run: |
|
||||
echo "$NEWEST_VERSION" > .last_version
|
||||
echo $(( $(date +%s) / 86400 )) > .last_rebuild
|
||||
git config user.name "$COMMIT_AUTHOR_NAME"
|
||||
git config user.email "$COMMIT_AUTHOR_EMAIL"
|
||||
git add .last_version .last_rebuild
|
||||
git commit -m "$COMMIT_MESSAGE"
|
||||
git commit -m "$COMMIT_MESSAGE" || echo "No commit"
|
||||
git push
|
Loading…
Add table
Add a link
Reference in a new issue