Skip to content

Improve the build_release workflow  #203

Closed as not planned
Closed as not planned
@mitchelbaker-cisa

Description

@mitchelbaker-cisa

Is your feature request related to a problem? Please describe.

#199 introduces a new GitHub workflow for automating LME's release process. The workflow still requires our team to go into the Actions tab and run the workflow manually, since one of the GitHub Actions (action-gh-release) used does not currently support updating an existing draft release.

For additional background here's a few similar issues in the action-gh-release repository where others have had issues updating an existing draft release:

#245
#284
#362

Describe the solution you'd like

The solution will be the same as the existing build_release.yaml file, except on.pull_request.types should contain opened/synchronize, which will trigger the workflow when a PR prefixed with "release-*" is opened or if commits are added to an existing release PR.

The build-release job is the same, except for some changes in the parameters. Instead of inputs.version we can get the release version programmatically in the Get Release Version step.

on:
    workflow_dispatch:
    push:
      branches:
        - main
      tags:
        - 'v[0-9]+.[0-9]+.[0-9]+*'  # match basic semver tags
    pull_request:
      types: 
        - opened
        - synchronize
      branches:
        - main
        - 'release-*'
  
jobs:
  lint:
    ...
          
  semgrep-scan:
    ...

  build-release:
    if: startsWith(github.head_ref, 'release')
    runs-on: ubuntu-latest
    needs: [lint, semgrep-scan]
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Get release version
        id: version
        run: |
          echo "version=${GITHUB_HEAD_REF##*-}" >> $GITHUB_ENV

      - name: Get current date 
        id: date
        run: | 
          echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

      - name: Build Assets
        run: git ls-files | zip LME-${{ env.version }}.zip -@

      - name: Build Changelog
        id: release
        uses: mikepenz/[email protected]
        with: 
          #fromTag: ${{ github.head_ref }}
          toTag: ${{ github.head_ref }} # ${{ github.ref }}
          configuration: "configuration.json"
          failOnError: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        
      - name: Create Draft Release 
        uses: softprops/[email protected]
        with:
          name: "LME v${{ env.version }}"
          tag_name: "v${{ env.version }}"
          append_body: true
          body: |
            ## [${{ env.version }}] - Timberrrrr! - ${{ env.date }} 
            ${{ steps.release.outputs.changelog }}
          files: LME-${{ env.version }}.zip
          draft: true
          prerelease: false
          discussion_category_name: "Announcements"
          generate_release_notes: false
          fail_on_unmatched_files: true
          token: ${{ secrets.GITHUB_TOKEN }}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Points: 2Story Point(6-8 hours)

Type

No type

Projects

  • Status

    ✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions