Skip to content

Commit

Permalink
skip prerelease versions of hls.js
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Oct 13, 2024
1 parent f231837 commit 0caab53
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions .github/workflows/bump_hls_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,42 @@ jobs:
&& git config user.email bot@mediamtx
&& ((git checkout deps/hlsjs && git rebase ${GITHUB_REF_NAME}) || git checkout -b deps/hlsjs)
- run: |
set -e
VERSION=$(curl -s https://api.github.com/repos/video-dev/hls.js/releases?per_page=1 | grep tag_name | sed 's/\s\+"tag_name": "\(.\+\)",/\1/')
HASH=$(curl -sL https://github.com/video-dev/hls.js/releases/download/$VERSION/release.zip -o- | sha256sum | cut -f1 -d ' ')
echo $VERSION > internal/servers/hls/hlsjsdownloader/VERSION
echo $HASH > internal/servers/hls/hlsjsdownloader/HASH
echo VERSION=$VERSION >> $GITHUB_ENV
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { createHash } = require('crypto');
const fs = require('fs').promises;
// get last release
let curRelease = null;
for (let i = 1; i < 20; i++) {
const releases = await github.rest.repos.listReleases({
owner: 'video-dev',
repo: 'hls.js',
page: i,
});
for (const release of releases.data) {
if (!release.prerelease) {
curRelease = release;
break;
}
}
if (curRelease !== null) {
break;
}
}
// compute checksum
const content = await github.request(`https://github.com/video-dev/hls.js/releases/download/${curRelease['tag_name']}/release.zip`);
const hash = createHash('sha256').update(Buffer.from(content.data)).digest('hex');
// write version and checksum to disk
await fs.writeFile('internal/servers/hls/hlsjsdownloader/VERSION', curRelease['tag_name'], 'utf-8');
await fs.writeFile('internal/servers/hls/hlsjsdownloader/HASH', hash, 'utf-8');
// make version available to next steps
core.exportVariable('VERSION', curRelease['tag_name']);
- id: check_repo
run: >
Expand Down

0 comments on commit 0caab53

Please sign in to comment.