Skip to content

Commit

Permalink
github action: add wokflow to genereate release-notes pr and release …
Browse files Browse the repository at this point in the history
…plugin

Signed-off-by: Vincent Gramer <[email protected]>
  • Loading branch information
vgramer committed Apr 5, 2021
1 parent 0299b82 commit 7237c4c
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/release_and_pulbish_plugin_on_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: publish plugin on JB and create release on GH

on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
jobs:
check-gradle-wrapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1

publish_plugin:
runs-on: ubuntu-latest
needs: [check-gradle-wrapper]
strategy:
matrix:
platform-version: [ 201, 202 ]
env:
ORG_GRADLE_PROJECT_platformVersion: ${{ matrix.platform-version }}
ORG_GRADLE_PROJECT_publishChannel: dev #todo change that after test
ORG_GRADLE_PROJECT_publishToken: ${{ secrets.PUBLISH_TOKEN }}
steps:
# Cache gradle dependencies
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: publish plugin
run: |
ORG_GRADLE_PROJECT_pluginVersion="${GITHUB_REF/refs\/tags\//}"
./gradlew :plugin:publishPlugin
- name: Upload artifact
uses: actions/[email protected]
with:
name: plugin-artifact
path: ./build/distributions/*.zip
retention-days: 1
if-no-files-found: error

create_github_release:
runs-on: ubuntu-latest
needs : [ publish_plugin ]
steps:
- uses: actions/checkout@v2
- name: Download Artifact
uses: actions/download-artifact@v2
id: download
with:
name: plugin-artifact
path: ./artifacts/

- name: create or update release note PR
env:
# Required for the `hub` CLI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${GITHUB_REF/refs\/tags\//}"
echo -e "${VERSION}\n" > gh_release_description.md
sed -e '0,/Release notes for v/d' -e '/Release notes for v/,$d' CHANGELOG.md >> gh_release_description.md
assets=''
for file in $(ls ./artifacts/); do assets="${assets} -a ./artifacts/${file}"; done
echo "assets=${assets}"
hub release create -F gh_release_description.md ${assets} "${VERSION}"
27 changes: 27 additions & 0 deletions .github/workflows/upset_release_notes_pr_on_push_on_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Create or update release notes PR

on:
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
upset_release_notes_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# needed to be able to resolve commit of previous version
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: "1.16"
- name: Download release-note tool
run: GO111MODULE=on go get k8s.io/release/cmd/[email protected]

- name: create or update release note PR
env:
# Required for the `hub` CLI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./hack/create_or_update_release_notes_pr.sh

0 comments on commit 7237c4c

Please sign in to comment.