Skip to content

Commit

Permalink
Release automation (#80)
Browse files Browse the repository at this point in the history
- Updates PR template
- Adds PR auto-labeling
- Adds workflow to trigger scheduled releases
- Adds workflow to create draft release for tags

{patch}

Signed-off-by: Esta Nagy <[email protected]>
  • Loading branch information
nagyesta authored May 8, 2022
1 parent 435a1d8 commit 719fdc9
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enhancement: feature/*
bug: bugfix/*
dependency: renovate/*
documentation: docs/*
release: release/*
16 changes: 16 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PullRequestLabeler
on:
pull_request:
types: [opened]

permissions: read-all

jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@bd0b592a410983316a454e3d48444608f028ec8e # tag=v3
with:
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_KEY }}
21 changes: 21 additions & 0 deletions .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CreateRelease
on:
push:
tags:
- v*

jobs:
build:
name: Draft release action
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e # tag=v6.0.0
with:
script: |
github.rest.repos.createRelease({
owner: "${{ github.repository_owner }}",
repo: "abort-mission",
tag_name: "${{ github.ref_name }}",
generate_release_notes: true,
draft: true
});
59 changes: 59 additions & 0 deletions .github/workflows/release-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: ReleaseTrigger
on:
workflow_dispatch:
inputs:
execution:
description: 'Type of execution'
required: true
default: 'Manual'
type: choice
options:
- Manual
schedule:
# * is a special character in YAML, so we have to quote this string
- cron: '0 4 5 * *'

jobs:
build:
name: Release trigger action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
with:
fetch-depth: 0
token: ${{ secrets.PUBLISH_KEY }}
- name: "Check existing tag"
id: check
run: |
echo "::set-output name=has_tag::$(git log --format='format:%d' --decorate-refs="refs/tags/v*" -n 1 | grep tag | wc -l)"
- name: Debug
run: |
echo "Has tag: ${{ steps.check.outputs.has_tag }}"
echo "---"
echo "Execution: ${{ github.event.inputs.execution }}"
echo "---"
echo "Should run: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}"
- name: "Update trigger"
if: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}
run: |
date +%s > .release-trigger
- name: "git branch"
if: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}
run: |
git config --global user.name 'Esta Nagy'
git config --global user.email '[email protected]'
git checkout -b release/run-${{ github.run_number }}
git add .release-trigger
git commit -asm "Triggering a release {patch}"
git push -f --set-upstream origin release/run-${{ github.run_number }}
- uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e # tag=v6.0.0
if: ${{ steps.check.outputs.has_tag == 0 || github.event.inputs.execution == 'Manual' }}
with:
script: |
github.rest.pulls.create({
owner: "${{ github.repository_owner }}",
repo: "abort-mission",
head: "release/run-${{ github.run_number }}",
base: "main",
title: "Triggering a release {patch}"
});
20 changes: 9 additions & 11 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
__Issue:__ <#issue number>

### Nature of change

- *e.g., New feature, bugfix, etc.*
__Issue:__ N/A <!-- #issue number -->

### Description
<!-- A short summary of changes -->

- *A short summary of changes*
-

### Entry point
<!-- Where should the reviewer start in order to properly understand the PR? -->

- *Where should the reviewer start in order to properly understand the PR?*
-

### Checklists

- [ ] I have rebased my branch
- [ ] My commit message is meaningful
- [x] I have rebased my branch
- [x] My commit message is meaningful
- [ ] The commit messages use semantic versioning: ```{major}```, ```{minor}``` or ```{patch}```
- [ ] The changes are focusing on the issue at hand
- [ ] Tests are passing
- [ ] I have maintained or increased test coverage

### Notes

- *Any additional remarks you may have.*
-
<!-- Any additional remarks you may have. -->

0 comments on commit 719fdc9

Please sign in to comment.