-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (33 loc) · 1.31 KB
/
restricted.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
# This is a generic workflow for releasing a Puppet module.
# It requires that the caller sets `secrets: inherit` to ensure
# that secrets are visible from steps in this workflow.
name: "Module Release"
on:
workflow_dispatch:
jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
steps:
- name: "Set up Ruby"
uses: "actions/setup-ruby@v1"
with:
ruby-version: "3.1"
- name: "Checkout"
uses: "actions/checkout@v4"
with:
ref: "${{ github.ref }}"
clean: true
fetch-depth: 0
#- name: "Get version"
# id: "get_version"
# run: |
# version=$(ruby scripts/get_version.rb)
# echo "version=$version" >> $GITHUB_OUTPUT
- name: "Get version"
id: "get_version"
run: |
ruby -e 'require "json"; version = JSON.parse(File.read("metadata.json"))["version"]; semver_regex = /\A(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?\z/; if version&.match?(semver_regex); puts "version=#{version}"; else; raise "Version #{version} is invalid. Exiting workflow."; end' >> $GITHUB_OUTPUT
- name: "print version"
run: |
echo ${{ steps.get_version.outputs.version }}