Skip to content

- Create tag now

- Create tag now #42

Workflow file for this run

---
# SPDX-FileCopyrightText: (c) 2025 ale5000
# SPDX-License-Identifier: GPL-3.0-or-later
name: "- Create tag now"
permissions: {}
on:
workflow_dispatch:
concurrency:
group: "${{ github.repository_id }}-${{ github.workflow }}"
cancel-in-progress: true
jobs:
tag-creation:
name: "Tag creation"
runs-on: ubuntu-latest
permissions:
contents: write # Needed to create a tag
actions: write # Needed to trigger a workflow
steps:
- name: "Checkout sources"
uses: actions/checkout@v4
- name: "Parse version"
id: "repo-info"
shell: bash
run: |
# Parsing version...
version="$(grep -m 1 -e '^version=' -- 'zip-content/module.prop' | cut -d '=' -f '2-' -s)" || exit "${?}"
printf 'version=%s\n' "${version:?}" >> "${GITHUB_OUTPUT?}" || exit "${?}"
- name: "Create tag"
uses: actions/github-script@v7
with:
retries: 3
script: |
/* jshint esversion: 6 */
console.log('::notice::Tag name: ${{ steps.repo-info.outputs.version }}');
const response = await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.repo-info.outputs.version }}',
sha: context.sha
}).catch(error => {
if(error.status === 422 && error.message === 'Reference already exists') {
console.warn('::warning::Tag already exist, ignored!!!');
return;
}
console.error('::error::Tag creation failed with error: ' + error.status);
console.error('::error::Error message: ' + error.message);
console.log('');
throw error;
});
if(response && response.status >= 200 && response.status < 300) {
console.log('');
console.log('Triggered the workflow for the release.');
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'auto-release-from-tag.yml',
ref: 'refs/tags/${{ steps.repo-info.outputs.version }}'
});
}