Skip to content

Commit

Permalink
Create GitHub action to build the plugin and create a draft release (#74
Browse files Browse the repository at this point in the history
)

* Fix input

* Remove params that are not available when creating the release

* Fix path to release upload zip

* Update version for testing

* Update create-plugin-release.yml to use dist-clean on cleanup

* Testing directory

* Update create-plugin-release.yml

* Update create-plugin-release.yml

* Remove file name suffix

* Remove debug steps

* revert plugin version

* Retrieve plugin id from config

* Use new github output method

* Add linter run

* Use non-archived release creation action
  • Loading branch information
vrutz authored Jun 21, 2024
1 parent 07bec0f commit 00d48d0
Showing 1 changed file with 41 additions and 34 deletions.
75 changes: 41 additions & 34 deletions .github/workflows/create-plugin-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,60 @@ name: Build and create pre-release for the EKS cluster plugin
on:
workflow_dispatch:
inputs:
version:
description: 'Version of the release'
required: true
target:
description: 'Commit hash or branch to release (optional, defaults to master)'
description: 'Commit hash or branch to release (optional, defaults to the current branch)'
required: false
skip_linter:
description: 'Skip the linter? (use true to skip)'
required: false
default: 'false'

jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ inputs.target || 'master' }}
ref: ${{ inputs.target || github.ref }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make
sudo apt-get install -y jq
- name: Check for make
run: make --version
- uses: chartboost/ruff-action@v1
if: ${{ inputs.skip_linter != 'true' || inputs.skip_linter != 'True' || inputs.skip_linter != 'TRUE' }}

- name: Run Makefile
- name: Retrieve plugin info
id: plugin_info
run: |
id=$(jq -r '.id' plugin.json)
version=$(jq -r '.version' plugin.json)
echo "Creating release for plugin '$id' and version '$version'"
echo "id=$id" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
- name: Compile plugin into archive
run: make plugin

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub pre-release and include the plugin archive as asset
uses: ncipollo/release-action@v1
with:
tag_name: "v${{ inputs.version }}"
release_name: "v${{ inputs.version }}"
target_commitish: ${{ inputs.target || 'master' }}
body: |
This is a pre-release for version of the DSS EKS plugin ${{ inputs.version }}.
Please modify the following release notes in this description prior to release.
draft: true
tag: "v${{ steps.plugin_info.outputs.version }}"
commit: ${{ inputs.target || github.ref }}
artifacts: "./dist/dss-plugin-${{ steps.plugin_info.outputs.id }}-${{ steps.plugin_info.outputs.version }}.zip"
artifactContentType: application/zip
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: false
prerelease: true
generate_release_notes: true

- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /dist/dss-plugin-eks-clusters-${{input.version}}.zip"
asset_name: "dss-plugin-eks-clusters-${{input.version}}"
asset_content_type: application/zip
- name: Archive release assets
run: rm -rf /dist
draft: true
generateReleaseNotes: true
allowUpdates: true
updateOnlyUnreleased: true
artifactErrorsFailBuild: true
replacesArtifacts: true

0 comments on commit 00d48d0

Please sign in to comment.