Skip to content

Commit fc5b75f

Browse files
author
sanfrancrisko
authored
Merge pull request #388 from carabasdaniel/releaseprepwf
Add automatic release prep workflow
2 parents 44b16a3 + 7ea5357 commit fc5b75f

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/auto_release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: "Auto release"
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 6'
6+
workflow_dispatch:
7+
8+
env:
9+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
10+
HONEYCOMB_DATASET: litmus tests
11+
SERVICE_URL: https://facade-main-6f3kfepqcq-ew.a.run.app/v1/provision
12+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
jobs:
15+
auto_release:
16+
name: "Automatic release prep"
17+
runs-on: ubuntu-20.04
18+
19+
steps:
20+
- name: "Honeycomb: Start recording"
21+
uses: kvrhdn/gha-buildevents@5be4636b81803713c94d7cb7e3a4b85d759df112 # pin@v1.0.2
22+
with:
23+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
24+
dataset: ${{ env.HONEYCOMB_DATASET }}
25+
job-status: ${{ job.status }}
26+
27+
- name: "Honeycomb: start first step"
28+
run: |
29+
echo STEP_ID="auto-release" >> $GITHUB_ENV
30+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
31+
32+
- name: "Checkout Source"
33+
uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
persist-credentials: false
37+
38+
- name: Activate Ruby 2.6
39+
uses: actions/setup-ruby@v1
40+
with:
41+
ruby-version: "2.6"
42+
43+
- name: Cache gems
44+
uses: actions/cache@v2
45+
with:
46+
path: vendor/gems
47+
key: ${{ runner.os }}-${{ github.event_name }}-${{ hashFiles('**/Gemfile') }}
48+
restore-keys: |
49+
${{ runner.os }}-${{ github.event_name }}-
50+
${{ runner.os }}-
51+
52+
- name: "Honeycomb: Record cache setup time"
53+
if: ${{ always() }}
54+
run: |
55+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Cache retrieval'
56+
echo STEP_ID="auto_release" >> $GITHUB_ENV
57+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
58+
59+
- name: Bundler Setup
60+
run: |
61+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config path vendor/gems' -- bundle config path vendor/gems
62+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config bin vendor/bins' -- bundle config bin vendor/bins
63+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config jobs 8' -- bundle config jobs 8
64+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config retry 3' -- bundle config retry 3
65+
buildevents cmd $TRACE_ID $STEP_ID 'bundle install' -- bundle install
66+
buildevents cmd $TRACE_ID $STEP_ID 'bundle clean' -- bundle clean
67+
echo ::group::bundler environment
68+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
69+
echo ::endgroup::
70+
71+
- name: "Honeycomb: Record Bundler Setup time"
72+
if: ${{ always() }}
73+
run: |
74+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Bundler Setup'
75+
echo STEP_ID="auto_release" >> $GITHUB_ENV
76+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
77+
78+
- name: "PDK Release prep"
79+
run: |
80+
buildevents cmd $TRACE_ID $STEP_ID 'pdk release prep' -- ./vendor/bins/pdk release prep --force
81+
82+
- name: "Commit changes"
83+
run: |
84+
git config --local user.email "action@github.com"
85+
git config --local user.name "GitHub Action"
86+
git add .
87+
git commit -m "Auto-Release prep"
88+
89+
- name: "Get Version"
90+
id: gv
91+
run: |
92+
echo "::set-output name=ver::$(cat metadata.json | jq .version)"
93+
94+
- name: Create Pull Request
95+
id: cpr
96+
uses: puppetlabs/peter-evans-create-pull-request@v3
97+
with:
98+
token: ${{ secrets.GITHUB_TOKEN }}
99+
commit-message: "Auto-release prep"
100+
branch: "release-prep"
101+
delete-branch: true
102+
title: "Auto-release prep ${{ steps.gv.outputs.ver }}"
103+
labels: "maintenance"
104+
105+
- name: PR outputs
106+
run: |
107+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
108+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)