diff --git a/.github/workflows/create-plugin-release.yml b/.github/workflows/create-plugin-release.yml index ffc6839..1a288f3 100644 --- a/.github/workflows/create-plugin-release.yml +++ b/.github/workflows/create-plugin-release.yml @@ -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