forked from micro5k/microg-unofficial-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (54 loc) · 2.03 KB
/
create-tag-now.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
# SPDX-FileCopyrightText: (c) 2025 ale5000
# SPDX-License-Identifier: GPL-3.0-or-later
name: "- Create tag now"
permissions: {}
on:
workflow_dispatch:
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"
run: |
# Parsing version...
version="$(grep -m 1 -e '^version=' -- 'zip-content/module.prop' | cut -d '=' -f '2-' -s)" || exit "${?}"
printf 'version=%s\n' "${version:-Empty}" >> "${GITHUB_OUTPUT?}"
- name: "Create tag"
uses: actions/github-script@v7
with:
script: |
console.log('::notice::Tag name: ${{ steps.repo-info.outputs.version }}')
const result = 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 => {
console.log(error.message)
if(error.status == 422 && error.message == 'Reference already exists') {
console.log('::warning::Tag already exist, ignored!!!')
return
}
console.log('::error::Tag creation failed with error ' + error.status)
console.log('')
console.log('DEBUG:')
throw error
})
if(result && result.status >= 200 && result.status < 300) {
console.log('')
console.log('Triggered the workflow for the release.')
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'auto-release-from-tag.yml',
ref: '${{ steps.repo-info.outputs.version }}'
})
}