Skip to content

Commit

Permalink
Chore: Add changelog + generation (#66)
Browse files Browse the repository at this point in the history
* Chore: fix changelog

* Add workflows for releasing
  • Loading branch information
morgante committed Jan 21, 2020
1 parent 3e2c8cd commit 1c0616f
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 5 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/generate-changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Generate new release changelog
on:
push:
branches:
- master
repository_dispatch:
types: generate-pr
schedule:
- cron: '0 2 * * *'
jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Update dependencies
run: npm install -g standard-version
- name: Generate changelog
run: |
standard-version
- run: git checkout "${GITHUB_REF:11}"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: chore
team-reviewers: terraform-google-modules/cft-admins
commit-message: 'chore(release): generate CHANGELOG for new version'
title: '[Release] New version notes'
body: |
Update changelog with information on next version.
branch: chore/changelog-generation
- name: Check outputs
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}"
40 changes: 40 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Create Release
on:
push:
branches:
- master
repository_dispatch:
types: generate-pr
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: read changelog
run: cat CHANGELOG.md | grep -o -P "\d\.\d\.\d" | head -n 1
- name: find release
id: find_version
run: |
VERSION=$(cat CHANGELOG.md | grep -o -P "\d\.\d\.\d" | head -n 1)
TAG=$(git describe --abbrev=0 --tags)
echo "::set-output name=version::v$VERSION"
echo "::set-output name=tag::$TAG"
- name: Check outputs
run: |
echo "Version Number - ${{ steps.find_version.outputs.version }}"
echo "Latest Tag - ${{ steps.find_version.outputs.tag }}"
- name: Create Release
id: create_release
if: steps.find_version.outputs.tag != steps.find_version.outputs.version
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.find_version.outputs.version }}
release_name: Release ${{ steps.find_version.outputs.version }}
body: |
Release ${{ steps.find_version.outputs.version }}
draft: false
prerelease: false
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Change Log
# Changelog

All notable changes to this project will be documented in this file.
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).
### [1.4.1](https://github.com/terraform-google-modules/terraform-google-vm/compare/v1.4.0...v1.4.1) (2020-01-21)

## [Unreleased]

### Bug Fixes

* derive project id for instance from instance template ([#63](https://github.com/terraform-google-modules/terraform-google-vm/issues/63)) ([3e2c8cd](https://github.com/terraform-google-modules/terraform-google-vm/commit/3e2c8cdeb2d0e6f1fe53bc2d0a9369c9dc59f013))

## [1.4.0] - 2020-01-08

Expand Down

0 comments on commit 1c0616f

Please sign in to comment.