-
Notifications
You must be signed in to change notification settings - Fork 24
56 lines (47 loc) · 1.67 KB
/
release_prep.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
name: "Release Prep"
on:
workflow_dispatch:
inputs:
target:
description: "The target for the release. This can be a commit sha or a branch."
required: false
default: "main"
version:
description: "Version of gem to be released."
required: true
jobs:
gem_release_prep:
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release_prep.yml@main"
with:
target: "${{ github.event.inputs.target }}"
version: "${{ github.event.inputs.version }}"
secrets: "inherit"
module_release_prep:
needs: gem_release_prep
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
ref: 'release-prep'
fetch-depth: 0
- name: "Update metadata.json"
run: |
current_version=$(jq --raw-output .version metadata.json)
# Update version in metadata.json, only matching first occurrence
sed -i "0,/$current_version/s//${{ github.event.inputs.version }}/" $(find . -name 'metadata.json')
- name: "Get version"
id: "get_version"
run: |
echo "version=$(jq --raw-output .version metadata.json)" >> $GITHUB_OUTPUT
- name: "Commit changes"
run: |
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Module Release prep v${{ steps.get_version.outputs.version }}"
- name: "Push changes"
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release-prep