From d75c9981bef21031c3ebc3b807de19d4dc304b28 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Sun, 12 Jan 2025 14:54:58 +0800 Subject: [PATCH] feat: add nightly workflow for automated release management --- .github/workflows/nightly.yml | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..97a98df1 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,64 @@ +name: nightly +permissions: + contents: write +on: + schedule: + - cron: '0 10 * * *' + push: + paths: + - '.github/workflows/nightly.yml' +jobs: + init: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const releases = await github.rest.repos.listReleases({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + for (const release of releases.data) { + if (release.tag_name === 'nightly') { + await github.rest.repos.deleteRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release.id, + }); + } + } + try { + await github.rest.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `tags/nightly`, + }); + } catch (error) {} + nightly: + needs: init + strategy: + matrix: + platform: + - runner: ubuntu-latest + os: ubuntu-latest + - runner: windows-latest + os: windows-latest + - runner: macos-latest + os: macos-latest + runs-on: ${{ matrix.platform.runner }} + steps: + - uses: actions/checkout@v4 + - uses: actboy168/action-zip@main + id: zip + with: + name: swi-prolog-docs-${{ matrix.platform.runner }}-${{ github.sha }} + path: | + src/* + README.rst + COPYING + - uses: softprops/action-gh-release@v1 + with: + name: nightly + tag_name: nightly + fail_on_unmatched_files: true + files: ${{ steps.zip.outputs.output }} \ No newline at end of file