Skip to content

Commit

Permalink
Add create release pr workflow (#1685)
Browse files Browse the repository at this point in the history
* add create release action

* rename workflow

* use a real version of the builder

* get version from bash command

* give action access to create a PR

* add body and commit message

* add message into PR description to close and reopen PR for merge checks

* correctly set variables in step

* remove workflow test
  • Loading branch information
mattseddon authored May 13, 2022
1 parent 8c98d02 commit 2587b61
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/changelog-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"categories": [
{
"title": "### 🚀 New Features and Enhancements",
"labels": ["product"]
},
{
"title": "### 🐛 Bug Fixes",
"labels": ["bug"]
},
{
"title": "### 🔨 Maintenance",
"labels": ["🏠 housekeeping"]
}
],
"pr_template": "- ${{TITLE}} [#${{NUMBER}}](https://github.com/iterative/vscode-dvc/pull/${{NUMBER}}) by [@${{AUTHOR}}](https://github.com/${{AUTHOR}})"
}
65 changes: 65 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create Release PR

on:
workflow_dispatch:
inputs:
override_version:
description:
'Override semver - can be used to bump minor and major versions'
type: string
required: false

jobs:
create-release-pr:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set Variables
id: set_variables
run: |
echo "::set-output name=last_release_tag::$(git describe --tags --abbrev=0)"
echo "::set-output name=release_date::$(date --rfc-3339=date)"
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configuration: .github/workflows/changelog-config.json
toTag: main
fromTag: ${{ steps.set_variables.outputs.last_release_tag }}

- name: Update Version
id: update_version
run: |
OVERRIDE_VERSION=${{ github.event.inputs.override_version }}
yarn workspace dvc version --new-version ${OVERRIDE_VERSION:-patch} --no-git-tag-version
echo "::set-output name=new_version::$(cat extension/package.json | jq -r .version)"
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: '[${{ steps.update_version.outputs.new_version }}]'
release-notes: ${{ steps.build_changelog.outputs.changelog }}
release-date: ${{ steps.set_variables.outputs.release_date }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
base: main
body: |
This PR updates the extension version and CHANGELOG.md.
Please close and reopen this PR to run the required workflows (Required statuses must pass before merging).
**This needs to be approved and merged before we run the `publish` workflow.**
commit-message: 'update version and changelog for release'
title: 'Update version and CHANGELOG for release'
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: echo "::set-output name=commit::$(git rev-parse HEAD)"

- name: Set Variables
id: set_variables
run: |
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Node.js environment
uses: actions/setup-node@v3
Expand All @@ -37,7 +41,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
body: ${{ steps.changelog_reader.outputs.changes }}
commit: ${{ steps.checkout.outputs.commit }}
commit: ${{ steps.set_variables.outputs.commit }}
name: ${{ steps.changelog_reader.outputs.version }}
tag: ${{ steps.changelog_reader.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 2587b61

Please sign in to comment.