diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..258f3ad --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,80 @@ +name: nightly + +on: + push: + #branches: + # - master + #paths: + # - '**/meson.build' + # - '**.c' + # - '**.h' + # - 'subprojects/*.wrap' + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + build: + uses: ./.github/workflows/package.yml + tag: + runs-on: ubuntu-latest + outputs: + tag_name: ${{ steps.tag_name.outputs.tag_name }} + permissions: + contents: write + steps: + - id: tag_name + run: echo "tag_name=nightly-$(date +%Y-%m-%d)" >> "$GITHUB_OUTPUT" + - uses: actions/github-script@v7 + with: + script: | + const tag_name = '${{ steps.tag_name.outputs.tag_name }}'; + + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${tag_name}`, + sha: context.sha + }).catch(_ => { + github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `tags/${tag_name}`, + sha: context.sha + }); + }) + release: + runs-on: ubuntu-latest + needs: + - build + - tag + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + name: packages + - id: create-release + uses: actions/github-script@v7 + with: + script: | + const release = await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: '${{ needs.tag.outputs.tag_name }}', + prerelease: true + }); + const globber = await glob.create('*.pkg.tar.zst'); + const files = await globber.glob(); + const fs = require('fs'); + + for (const file of files) { + await github.rest.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release.data.id, + name: file, + data: await fs.readFileSync(file) + }); + } diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 5e5392f..1e72529 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,7 +1,8 @@ name: package -on: [push] +on: + workflow_call: jobs: - build: + arch: runs-on: ubuntu-24.04 container: image: archlinux:base-devel