Skip to content

Auto Release

Auto Release #10

Workflow file for this run

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 }}
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: |
const tags = await github.rest.repos.listTags({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
});
return tags.data.map(tag => tag.name);
- 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
.map(release => release.replace(/-xanmod1$/, ''))
.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 }}
build_missing_releases:
name: Build Missing Releases
needs: check_releases
runs-on: ubuntu-latest
if: ${{ needs.check_releases.outputs.missing_tags != '[]' }}
strategy:
matrix:
tag: ${{ fromJson(needs.check_releases.outputs.missing_tags) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Trigger Release Workflow
uses: ./.github/workflows/release.yml
with:
version: ${{ matrix.tag }}