Skip to content

Commit

Permalink
github: Add nightly workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestask committed Jul 4, 2024
1 parent 1a4d835 commit 49ce968
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 2 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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)
});
}
5 changes: 3 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: package
on: [push]
on:
workflow_call:
jobs:
build:
arch:
runs-on: ubuntu-24.04
container:
image: archlinux:base-devel
Expand Down

0 comments on commit 49ce968

Please sign in to comment.