-
Notifications
You must be signed in to change notification settings - Fork 6
63 lines (56 loc) · 1.98 KB
/
test-tag.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
57
58
59
60
61
62
63
name: Test Workflow
on:
workflow_dispatch:
inputs:
kernel-version:
type: string
required: true
proxmox-version:
type: string
required: true
env:
DEBIAN_FRONTEND: noninteractive
KERNEL_VERSION: "6.2.16-99-pve"
PROXMOX_VERSION: "8.0"
#RELEASE_TITLE: "PVE kernel 6.2.16.99-pve-relaxablermrr release (Promox 8.0}"
RELEASE_TITLE: "Proxmox VE kernel ${{ inputs.kernel-version }}-relaxablermrr (Proxmox VE ${{ inputs.proxmox-version }})"
jobs:
test:
name: This is a tag test job
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create release tag
uses: actions/github-script@v6
env:
CLIENT_PAYLOAD: ${{ toJSON(github.event.client_payload) }}
with:
script: |
const tagName = "${{ inputs.kernel-version }}";
const branch = "main";
const tagger = {
name: "Github Actions",
email: "[email protected]"
};
const { owner, repo } = context.repo;
console.log("Finding out the HEAD hash");
let ref = `heads/${branch}`;
const head = await github.rest.git.getRef({ owner, repo, ref });
console.log("head: ", head);
const sha = head.data.object.sha;
// Create tag object. This is only needed for annotated tags
console.log(`Creating tag ${tagName}`);
const newTag = await github.rest.git.createTag({
owner,
repo,
tag: tagName,
message: process.env.RELEASE_TITLE,
object: sha,
type: "commit",
tagger
});
// Create tag reference
ref = `refs/tags/${tagName}`;
console.log(`Creating ref for tag ${tagName} (${newTag.data.sha})`);
const newRef = await github.rest.git.createRef({ owner, repo, ref, sha: newTag.data.sha });