Skip to content

Commit 7aee751

Browse files
authored
Merge pull request #425 from puppetlabs/pdksync_CONT-229-Implement_reusable_workflows
pdksync - CONT-229-Implement reusable workflows
2 parents 71f5a32 + 8966f21 commit 7aee751

File tree

5 files changed

+25
-260
lines changed

5 files changed

+25
-260
lines changed

.github/workflows/auto_release.yml

Lines changed: 4 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,88 +3,8 @@ name: "Auto release"
33
on:
44
workflow_dispatch:
55

6-
env:
7-
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
8-
HONEYCOMB_DATASET: litmus tests
9-
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10-
116
jobs:
12-
auto_release:
13-
name: "Automatic release prep"
14-
runs-on: ubuntu-20.04
15-
16-
steps:
17-
18-
- name: "Honeycomb: Start recording"
19-
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
20-
with:
21-
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
22-
dataset: ${{ env.HONEYCOMB_DATASET }}
23-
job-status: ${{ job.status }}
24-
25-
- name: "Honeycomb: start first step"
26-
run: |
27-
echo STEP_ID="auto-release" >> $GITHUB_ENV
28-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
29-
- name: "Checkout Source"
30-
if: ${{ github.repository_owner == 'puppetlabs' }}
31-
uses: actions/checkout@v3
32-
with:
33-
fetch-depth: 0
34-
persist-credentials: false
35-
36-
- name: "PDK Release prep"
37-
uses: docker://puppet/pdk:2.6.1.0
38-
with:
39-
args: 'release prep --force'
40-
env:
41-
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
43-
- name: "Get Version"
44-
if: ${{ github.repository_owner == 'puppetlabs' }}
45-
id: gv
46-
run: |
47-
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
48-
49-
- name: "Check if a release is necessary"
50-
if: ${{ github.repository_owner == 'puppetlabs' }}
51-
id: check
52-
run: |
53-
git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true"
54-
55-
- name: "Commit changes"
56-
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
57-
run: |
58-
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
59-
git config --local user.name "GitHub Action"
60-
git add .
61-
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
62-
63-
- name: Create Pull Request
64-
id: cpr
65-
uses: puppetlabs/peter-evans-create-pull-request@v3
66-
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
67-
with:
68-
token: ${{ secrets.GITHUB_TOKEN }}
69-
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
70-
branch: "release-prep"
71-
delete-branch: true
72-
title: "Release prep v${{ steps.gv.outputs.ver }}"
73-
body: |
74-
Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}.
75-
Please verify before merging:
76-
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
77-
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
78-
- [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match
79-
labels: "maintenance"
80-
81-
- name: PR outputs
82-
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
83-
run: |
84-
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
85-
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
86-
87-
- name: "Honeycomb: Record finish step"
88-
if: ${{ always() }}
89-
run: |
90-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'
7+
release_prep:
8+
name: "Release Prep"
9+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release_prep.yml@main"
10+
secrets: "inherit"

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
name: "PR Testing"
1+
name: "ci"
22

3-
on: [pull_request]
3+
on:
4+
pull_request:
5+
branches:
6+
- "main"
7+
workflow_dispatch:
48

59
env:
610
SERVICE_URL: https://facade-maint-config-windows-use-ssh-6f3kfepqcq-ew.a.run.app/v1/provision
7-
11+
812
jobs:
13+
Spec:
14+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
15+
secrets: "inherit"
16+
917
setup_matrix:
1018
name: "Setup Test Matrix"
19+
needs: "Spec"
1120
runs-on: ubuntu-latest
1221
outputs:
1322
matrix: ${{ steps.get-matrix.outputs.matrix }}
@@ -36,7 +45,6 @@ jobs:
3645
id: get-matrix
3746
run: |
3847
bundle exec matrix_from_metadata_v2
39-
bundle exec matrix_from_metadata_v2
4048
4149
Acceptance:
4250
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
@@ -49,9 +57,7 @@ jobs:
4957
fail-fast: false
5058
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
5159

52-
5360
steps:
54-
5561
- name: Checkout Source
5662
uses: actions/checkout@v2
5763

.github/workflows/nightly.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ env:
88
SERVICE_URL: https://facade-maint-config-windows-use-ssh-6f3kfepqcq-ew.a.run.app/v1/provision
99

1010
jobs:
11+
Spec:
12+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
13+
secrets: "inherit"
14+
1115
setup_matrix:
1216
name: "Setup Test Matrix"
17+
needs: "Spec"
1318
runs-on: ubuntu-latest
1419
outputs:
1520
matrix: ${{ steps.get-matrix.outputs.matrix }}
@@ -38,7 +43,6 @@ jobs:
3843
id: get-matrix
3944
run: |
4045
bundle exec matrix_from_metadata_v2
41-
bundle exec matrix_from_metadata_v2
4246
4347
Acceptance:
4448
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
@@ -51,9 +55,7 @@ jobs:
5155
fail-fast: false
5256
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
5357

54-
5558
steps:
56-
5759
- name: Checkout Source
5860
uses: actions/checkout@v2
5961

.github/workflows/release.yml

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,7 @@ on:
44
workflow_dispatch:
55

66
jobs:
7-
create-github-release:
8-
name: Deploy GitHub Release
9-
runs-on: ubuntu-20.04
10-
steps:
11-
- name: Checkout code
12-
uses: actions/checkout@v3
13-
with:
14-
ref: ${{ github.ref }}
15-
clean: true
16-
fetch-depth: 0
17-
- name: Get Version
18-
id: gv
19-
run: |
20-
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
21-
- name: Create Release
22-
uses: actions/create-release@v1
23-
id: create_release
24-
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
with:
27-
tag_name: "v${{ steps.gv.outputs.ver }}"
28-
draft: false
29-
prerelease: false
30-
31-
deploy-forge:
32-
name: Deploy to Forge
33-
runs-on: ubuntu-20.04
34-
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v3
37-
with:
38-
ref: ${{ github.ref }}
39-
clean: true
40-
- name: "PDK Build"
41-
uses: docker://puppet/pdk:nightly
42-
with:
43-
args: 'build'
44-
- name: "Push to Forge"
45-
uses: docker://puppet/pdk:nightly
46-
with:
47-
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'
7+
release:
8+
name: "Release"
9+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release.yml@main"
10+
secrets: "inherit"

.github/workflows/spec.yml

Lines changed: 0 additions & 126 deletions
This file was deleted.

0 commit comments

Comments
 (0)