forked from open-policy-agent/opa-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github action: add wokflow to genereate release-notes pr and release …
…plugin Signed-off-by: Vincent Gramer <[email protected]>
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
27
.github/workflows/upset_release_notes_pr_on_push_on_master.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |