diff --git a/.github/scripts/sync_spec_version.sh b/.github/scripts/sync_spec_version.sh index 29ee77e..ca38115 100644 --- a/.github/scripts/sync_spec_version.sh +++ b/.github/scripts/sync_spec_version.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -dnf install -y tito git +dnf install -y tito git gh git config --global --add safe.directory /workspace git config --global user.email 'git@suyogtandel.in' @@ -42,12 +42,21 @@ done sed -i "s/^Release:.*/Release: ${NEW_RELEASE}%{?dist}/" picoforge.spec +BRANCH_NAME="spec-sync/${NEW_VERSION}-${NEW_RELEASE}" +git checkout -b "$BRANCH_NAME" + if git diff --quiet picoforge.spec; then -echo "No changes to spec file." + echo "No changes to spec file." + CHANGES_MADE=false else -git add picoforge.spec -git commit -m "chore: sync spec to $NEW_VERSION [skip ci]" + git add picoforge.spec + git commit -m "chore: sync spec to $NEW_VERSION-$NEW_RELEASE [skip ci]" + CHANGES_MADE=true fi tito tag --offline --accept-auto-changelog --keep-version -git push --follow-tags origin HEAD:main HEAD:release \ No newline at end of file +git push origin "$BRANCH_NAME" --follow-tags + +if [ "$CHANGES_MADE" = true ]; then + gh pr create --base main --head "$BRANCH_NAME" --title "chore: sync spec to $NEW_VERSION-$NEW_RELEASE" --body "Automated spec/tag sync from release workflow." +fi \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cd5eae..f568dad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,5 @@ name: "publish-stable" on: - push: - branches: - - release workflow_dispatch: workflow_run: workflows: ["PicoForge CI"] @@ -13,7 +10,7 @@ on: jobs: build-and-release: - if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' + if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' permissions: contents: write issues: write @@ -52,7 +49,7 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 @@ -143,7 +140,7 @@ jobs: ./.github/scripts/build_flatpak.sh ${{ matrix.platform }} - name: Upload Release Assets - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v3 with: tag_name: v${{ env.version }} name: "PicoForge-v${{ env.version }}"