Skip to content

Release 12.0.1.24

Release 12.0.1.24 #185

Workflow file for this run

name: Tag Release
on:
workflow_dispatch:
push:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check for release version
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: check
with:
script: |
const { owner, repo } = context.repo
const regex = /\d+\.\d+\.\d+\.\d+/g;
if (regex.test(`${{ github.event.head_commit.message }}`)) {
return "build"
} else {
const run_id = "${{ github.run_id }}";
await github.rest.actions.cancelWorkflowRun({ owner, repo, run_id });
}
result-encoding: string
tag:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Luacheck
uses: nebularg/actions-luacheck@dd48c197053814ed6e9e73f34ac37051b48a4bbf # v1.1.2
with:
args: --no-color -q
annotate: warning
- name: Set release
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ secrets.REPOSITORY_ACCESS_TOKEN }}
script: |
const fs = require("fs")
const path = require("path")
const sourceFile = path.join(process.env.GITHUB_WORKSPACE, "Aurora_Mainline.toc")
const source = fs.readFileSync(sourceFile, "utf8")
const match = source.match(/##\s*Version\s*:\s*(\d+\.\d+\.\d+\.\d+)/)
if (!match) {
core.setFailed(`Unable to find addon version in ${sourceFile}`)
return
}
const version = match[1]
const tagName = version
const ref = `tags/${tagName}`
const { owner, repo } = context.repo
try {
await github.rest.git.getRef({ owner, repo, ref })
core.info(`Tag ${tagName} already exists; skipping creation.`)
return tagName
} catch (error) {
if (error.status !== 404) {
throw error
}
}
const tag = await github.rest.git.createTag({
owner,
repo,
tag: tagName,
message: "release",
object: context.sha,
type: "commit",
})
await github.rest.git.createRef({
owner,
repo,
ref: `refs/tags/${tagName}`,
sha: tag.data.sha,
})
core.info(`Created release tag ${tagName}`)
return tagName