This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
generated from codenamephp/template.chef.cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (86 loc) · 3.2 KB
/
prepare-release.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Prepare Release
on:
push:
branches: [ release ]
paths-ignore:
- '**.md'
jobs:
calculate_next_version:
name: Calculate next release version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.next-version }}
steps:
- name: calculate next version
id: version
uses: patrickjahns/version-drafter-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
draft_release:
name: Create draft release
runs-on: ubuntu-latest
needs: calculate_next_version
steps:
- name: draft release
uses: release-drafter/release-drafter@v5
with:
version: ${{ format('{0}', needs.calculate_next_version.outputs.version) }}
tag: ${{ format('{0}', needs.calculate_next_version.outputs.version) }}
name: ${{ format('{0}', needs.calculate_next_version.outputs.version) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update_changelog:
name: Update changelog
runs-on: ubuntu-latest
needs: calculate_next_version
steps:
- name: checkout
uses: actions/checkout@v2
- name: create changelog
uses: charmixer/auto-changelog-action@v1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude_labels: "duplicate,question,invalid,wontfix,skip-changelog"
future_release: ${{ format('{0}', needs.calculate_next_version.outputs.version) }}
release_branch: 'release'
- name: commit updated changelog
uses: EndBug/add-and-commit@v7
with:
message: "[CHANGELOG] Updated changelog"
add: "CHANGELOG.md"
signoff: true
bump_cookbook_version:
name: Bump cookbook version and check upload
runs-on: ubuntu-latest
needs: calculate_next_version
env:
CHEF_LICENSE: accept-no-persist
steps:
- name: checkout
uses: actions/checkout@v2
- name: install chef
uses: actionshub/chef-install@main
- name: Create key
run: 'echo "$CHEF_KEY" > codenamephp.pem'
shell: bash
env:
CHEF_KEY: ${{secrets.CHEF_KEY}}
- name: Install spork
run: chef exec gem install knife-spork
- name: Get cookbook name
id: get_cookbook_name
run: |
export COOKBOOK_NAME=`chef exec ruby -e 'require "chef/cookbook/metadata"; metadata = Chef::Cookbook::Metadata.new; metadata.from_file("metadata.rb"); puts metadata.name'`
echo "::set-output name=cookbook_name::$COOKBOOK_NAME"
- name: Bump cookbook version in metadata
run: knife spork bump ${{ steps.get_cookbook_name.outputs.cookbook_name }} manual ${{ format('{0}', needs.calculate_next_version.outputs.version) }} -o ..
- name: Check cookbook version in metadata
run: knife spork check ${{ steps.get_cookbook_name.outputs.cookbook_name }} -o .. --fail
- name: Dry run deploy to supermarket
run: knife supermarket share ${{ steps.get_cookbook_name.outputs.cookbook_name }} -o .. --dry-run
- name: commit bumped metadata
uses: EndBug/add-and-commit@v7
with:
message: "[METADATA] Updated version"
add: "metadata.rb"
signoff: true