Skip to content

Commit

Permalink
release action now updates plugin repo
Browse files Browse the repository at this point in the history
  • Loading branch information
claymccoy committed Feb 26, 2020
1 parent 199fa3d commit 0851a8a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ on:

jobs:
build:
name: Build Plugin
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: checkout code
uses: actions/checkout@v2
- name: Run tests
- name: run tests
run: ./gradlew test
- name: Build
- name: build
run: ./gradlew releaseBundle
- name: Archive build artifacts
- name: archive build artifacts
uses: actions/upload-artifact@v1
with:
name: dist
Expand Down
33 changes: 19 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ on:

jobs:
build:
name: Upload Release Asset
name: Release Plugin
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: checkout code
uses: actions/checkout@v2
- name: Run tests
- name: run tests
run: ./gradlew test
- name: Build
- name: build
run: ./gradlew releaseBundle
- name: Get tag name
id: get_tag_name
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create release
- name: get project info
id: get_project_info
run: |
echo ::set-output name=PROJECT::$(basename `pwd`)
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: create release
id: create_release
uses: actions/create-release@v1
env:
Expand All @@ -29,14 +31,17 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload release asset
id: upload-release-asset
- name: upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/distributions/springExamplePlugin-${{ steps.get_tag_name.outputs.VERSION }}.zip
asset_name: springExamplePlugin-${{ steps.get_tag_name.outputs.VERSION }}.zip
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/distributions/${{ steps.get_project_info.outputs.PROJECT }}-${{ steps.get_project_info.outputs.VERSION }}.zip
asset_name: ${{ steps.get_project_info.outputs.PROJECT }}-${{ steps.get_project_info.outputs.VERSION }}.zip
asset_content_type: application/zip

- name: add release to plugin repo
run: |
curl -XPOST -u "${{ secrets.USERNAME }}:${{ secrets.TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/spinnaker-plugin-examples/examplePluginRepository/dispatches --data "{\"event_type\": \"onPluginRelease\", \"client_payload\": {\"org\": \"spinnaker-plugin-examples\", \"repo\": \"${{ steps.get_project_info.outputs.PROJECT }}\", \"released\": $(cat build/distributions/plugin-info.json)}}"

0 comments on commit 0851a8a

Please sign in to comment.