-
-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (61 loc) · 2.27 KB
/
release.yml
File metadata and controls
65 lines (61 loc) · 2.27 KB
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
64
65
# This workflow is used for publishing releases.
#
# Before triggering a release the `../../semver.txt` file should be updated in the
# relevant branch.
#
# Before triggering a major release or when planning a switch:
# follow the instructions in `../../docs/dev/processes/major_version_switch.md`.
#
# When committing the version change in `semver.txt` the commit message is
# important as it will be used for the release in GitHub.
#
# For an example commit browse to
# https://github.com/CycloneDX/cyclonedx-dotnet/commit/d110af854371374460430bb8438225a7d7a84274.
#
# The resulting release is here
# https://github.com/CycloneDX/cyclonedx-dotnet/releases/tag/v1.0.0.
#
# Releases are triggered manually. This can be done by browsing to
# https://github.com/CycloneDX/cyclonedx-php-composer/actions?query=workflow%3ARelease
# and selecting "Run workflow". If releasing a patch for a previous version
# make sure the correct branch is selected. It will default to the default
# branch.
name: Release
on:
workflow_dispatch
permissions: {}
jobs:
release:
name: Release
permissions:
id-token: write
contents: write # to create a release
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set the version
id: set_version
run: |
VERSION=`cat semver.txt`
echo "version=$VERSION" >> $GITHUB_OUTPUT
if [[ "$VERSION" =~ (alpha|beta|rc) ]]
then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Create github release and git tag for release
id: create_release
# see https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ steps.set_version.outputs.version }}
tag_name: v${{ steps.set_version.outputs.version }}
draft: false
prerelease: ${{ steps.set_version.outputs.prerelease }}
target_commitish: ${{ github.head_ref || github.ref_name }}