Skip to content

Update edge image #3229

Update edge image

Update edge image #3229

name: Update edge image
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
ref: main
- name: Fetch release version
id: fetch-release
run: |
curl -sL -o release.json https://api.github.com/repos/aldostools/webMAN-MOD/releases/latest
export PS3NETSRV_VERSION=$(jq -r '.assets[] | select(.name | startswith("ps3netsrv")) | .name' release.json | \
sed -e 's/ps3netsrv_\(.*\)\.zip/\1/')
export RELEASE_TAG=$(jq -r '.tag_name' release.json)
if [ -n "$PS3NETSRV_VERSION" ]; then
echo "Found ps3netsrv release $PS3NETSRV_VERSION"
# replacing APP_VERSION and RELEASE_TAG in .github/workflows/docker-publish.yml
sed -ri "s/^(\s*)(APP_VERSION\s*:\s*.*\s*$)/\1APP_VERSION: \"$PS3NETSRV_VERSION\"/" .github/workflows/docker-publish.yml
sed -ri "s/^(\s*)(RELEASE_TAG\s*:\s*.*\s*$)/\1RELEASE_TAG: \"$RELEASE_TAG\"/" .github/workflows/docker-publish.yml
echo "Updated APP_VERSION with $PS3NETSRV_VERSION in .github/workflows/docker-publish.yml"
# replacing PS3NETSRV_RELEASE and PS3NETSRV_VERSION in Dockerfile
sed -ri "s/(PS3NETSRV_VERSION=.+)/PS3NETSRV_VERSION=$PS3NETSRV_VERSION/" Dockerfile
sed -ri "s/(PS3NETSRV_RELEASE=.+)/PS3NETSRV_RELEASE=$RELEASE_TAG/" Dockerfile
echo "Updated APP_VERSION with $PS3NETSRV_VERSION in Dockerfile"
echo ::set-output name=version::$PS3NETSRV_VERSION
echo ::set-output name=tag::$RELEASE_TAG
fi
rm -f release.json
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
- name: Commit latest release version
if: steps.git-check.outputs.modified == 'true'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "chore: update ps3netsrv to ${{ steps.fetch-release.outputs.version }}"
git push