Skip to content

Commit

Permalink
Add release automation
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Jan 21, 2020
1 parent 1a39c7d commit 9a55558
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 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
6 changes: 6 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"skip": {
"commit": true,
"tag": true
}
}

0 comments on commit 9a55558

Please sign in to comment.