generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (42 loc) · 1.51 KB
/
release.yaml
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
# https://docs.github.com/en/actions
name: "Release"
on: # yamllint disable-line rule:truthy
push:
tags:
- "**"
jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- name: "Determine tag"
if: "${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'tag'"
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
shell: "bash"
- name: "Create release"
uses: "actions/github-script@v7.0.1"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
if (!process.env.RELEASE_TAG) {
core.setFailed("The environment variable RELEASE_TAG is not defined.")
return;
}
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: process.env.RELEASE_TAG,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.RELEASE_TAG,
target_commitish: "develop",
});
core.exportVariable('RELEASE_HTML_URL', response.data.html_url);
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}