Skip to content

Commit 776e615

Browse files
authored
Merge pull request #30 from genebean/ci_improvements
Update testing workflow, add release workflow
2 parents c33a1e8 + 4757610 commit 776e615

File tree

3 files changed

+87
-11
lines changed

3 files changed

+87
-11
lines changed

.github/workflows/ci.yml renamed to .github/workflows/pr_test.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
name: CI
1+
name: PR Testing
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
7-
push:
4+
- pull_request
85

96
jobs:
107
test:
11-
runs-on: ubuntu-18.04
8+
runs-on: ubuntu-latest
129
strategy:
1310
matrix:
1411
puppet_versions:
@@ -18,11 +15,12 @@ jobs:
1815
name: Puppet ${{ matrix.puppet_versions }}
1916
steps:
2017
- uses: actions/checkout@v1
21-
- name: Install the Puppet PDK
18+
- name: Install the PDK
2219
run: |
23-
wget https://apt.puppet.com/puppet-tools-release-bionic.deb
24-
sudo dpkg -i puppet-tools-release-bionic.deb
25-
sudo apt-get update
20+
source /etc/os-release
21+
wget https://apt.puppet.com/puppet-tools-release-${UBUNTU_CODENAME}.deb
22+
sudo dpkg -i puppet-tools-release-${UBUNTU_CODENAME}.deb
23+
sudo apt-get update
2624
sudo apt-get install pdk
2725
- name: Syntax validation
2826
run: pdk validate --puppet-version ${{ matrix.puppet_versions }}

.github/workflows/release.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish Module
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
publish-module:
7+
name: Tag Release and Publish to Forge
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.ref }}
14+
clean: true
15+
fetch-depth: 0
16+
- name: Get Version
17+
id: gv
18+
run: |
19+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
20+
- name: Install the PDK
21+
run: |
22+
source /etc/os-release
23+
wget https://apt.puppet.com/puppet-tools-release-${UBUNTU_CODENAME}.deb
24+
sudo dpkg -i puppet-tools-release-${UBUNTU_CODENAME}.deb
25+
rm -f puppet-tools-release-${UBUNTU_CODENAME}.deb
26+
sudo apt-get update
27+
sudo apt-get install pdk
28+
pdk bundle install
29+
- name: Validate Docs
30+
run: |
31+
set -e
32+
documentation=$(pdk bundle exec puppet strings generate --format markdown)
33+
if [ $(echo $documentation | grep -Ec "[1-9]+ undocumented|\[warn\]") -gt 0 ]; then
34+
echo "Please resolve documentation issues detected below:"
35+
echo $documentation
36+
exit 1
37+
fi
38+
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
39+
echo "Here is the current git status:"
40+
git status
41+
echo
42+
echo "The following changes were detected:"
43+
git --no-pager diff
44+
echo "Please submit a PR of changes after running 'pdk bundle exec puppet strings generate --format markdown'"
45+
exit 1
46+
fi
47+
- name: Validate Changelog
48+
env:
49+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
set -e
52+
pdk bundle exec rake changelog
53+
check_prs=$(grep -c '### UNCATEGORIZED PRS; LABEL THEM ON GITHUB' CHANGELOG.md) || echo "Check PRs success"
54+
if [ $check_prs -gt 0 ]; then
55+
echo "Uncategorized PRs found. Please address missing labels in the PRs below:"
56+
git --no-pager diff CHANGELOG.md
57+
exit 1
58+
fi
59+
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
60+
echo "Here is the current git status:"
61+
git status
62+
echo
63+
echo "The following changes were detected:"
64+
git --no-pager diff
65+
echo "Uncommitted PRs found in the changelog. Please submit a PR of changes after running 'pdk bundle exec rake changelog'"
66+
exit 1
67+
fi
68+
- name: Tag Release
69+
uses: ncipollo/release-action@v1
70+
with:
71+
tag: ${{ steps.gv.outputs.ver }}
72+
token: ${{ secrets.GITHUB_TOKEN }}
73+
draft: false
74+
prerelease: false
75+
- name: Build Module
76+
run: pdk build
77+
- name: Push to Forge
78+
run: pdk release publish --forge-token ${{ secrets.PUPPET_FORGE_API_KEY }} --force

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![](https://img.shields.io/puppetforge/pdk-version/grafana/promtail.svg?style=popout)
44
![](https://img.shields.io/puppetforge/v/grafana/promtail.svg?style=popout)
55
![](https://img.shields.io/puppetforge/dt/grafana/promtail.svg?style=popout)
6-
![](https://github.com/grafana/puppet-promtail/workflows/CI/badge.svg)
6+
[![Build Status](https://github.com/grafana/puppet-promtail/actions/workflows/pr_test.yml/badge.svg?branch=main)](https://github.com/grafana/puppet-promtail/actions/workflows/pr_test.yml)
77
[![License](https://img.shields.io/github/license/grafana/puppet-promtail?stype=popout)](LICENSE)
88

99
Deploy and configure Grafana's Promtail on a node.

0 commit comments

Comments
 (0)