Skip to content

Auto Release

Auto Release #18

Workflow file for this run

name: Auto Release
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
env:
LTS: 6.6.
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: Determine Latest LTS
id: latest_lts
uses: actions/github-script@v7
with:
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 }}
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 }}