Auto Release #200
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
check_releases: | |
name: Check for Missing Releases | |
runs-on: ubuntu-latest | |
outputs: | |
missing_tags: ${{ steps.filter_tags.outputs.result }} | |
lts: ${{ steps.latest_lts.outputs.result }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Xanmod tags | |
id: get_xanmod_tags | |
run: | | |
echo "::set-output name=xanmod_tags::$(curl 'https://gitlab.com/api/v4/projects/xanmod%2Flinux/releases?per_page=100&order_by=created_at&sort=desc' -sL | jq -c 'map(.tag_name)')" | |
- name: Get Existing GitHub Tags | |
id: get_github_tags | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
let allTags = []; | |
let page = 1; | |
let hasNextPage = true; | |
while (hasNextPage) { | |
const response = await github.rest.repos.listTags({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
per_page: 100, | |
page: page, | |
}); | |
allTags = allTags.concat(response.data.map(tag => tag.name)); | |
hasNextPage = response.data.length === 100; | |
page++; | |
} | |
return allTags; | |
- name: Filter Missing Tags | |
id: filter_tags | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { xanmod_tags, github_tags } = process.env | |
const xanmodTags = JSON.parse(`${xanmod_tags}`); | |
const githubTags = JSON.parse(`${github_tags}`); | |
const missingTags = xanmodTags | |
.filter(tag => !githubTags.includes(tag)); | |
return missingTags; | |
env: | |
xanmod_tags: ${{ steps.get_xanmod_tags.outputs.xanmod_tags }} | |
github_tags: ${{ steps.get_github_tags.outputs.result }} | |
- name: Get Latest LTS Kernel Version | |
id: get_latest_lts_kernel | |
run: | | |
echo "::set-output name=result::$(curl -sL https://www.kernel.org/releases.html | egrep -o '<td>[0-9]+\.[0-9]+</td>' | head -1 | egrep -o '[0-9]+\.[0-9]+')" | |
- name: Determine Latest LTS | |
id: latest_lts | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { xanmod_tags, LTS } = process.env | |
const xanmodTags = JSON.parse(`${xanmod_tags}`); | |
const ltsTags = xanmodTags | |
.filter(tag => tag.startsWith(`${LTS}.`)) | |
.filter(tag => !tag.includes('rt')); | |
return ltsTags.length > 0 ? ltsTags[0] : null; | |
env: | |
xanmod_tags: ${{ steps.get_xanmod_tags.outputs.xanmod_tags }} | |
LTS: ${{ steps.get_latest_lts_kernel.outputs.result }} | |
build_missing_releases: | |
needs: check_releases | |
if: ${{ needs.check_releases.outputs.missing_tags != '[]' }} | |
uses: ./.github/workflows/release.yml | |
strategy: | |
fail-fast: false | |
matrix: | |
tag: ${{ fromJson(needs.check_releases.outputs.missing_tags) }} | |
with: | |
version: ${{ matrix.tag }} | |
latest: ${{ matrix.tag == needs.check_releases.outputs.lts }} |