Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the build_release workflow #203

Open
mitchelbaker-cisa opened this issue Feb 27, 2024 · 0 comments
Open

Improve the build_release workflow #203

mitchelbaker-cisa opened this issue Feb 27, 2024 · 0 comments
Assignees
Labels
Points: 2 Story Point(6-8 hours)

Comments

@mitchelbaker-cisa
Copy link
Collaborator

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/release-changelog-builder-action@v4.1.1
        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/action-gh-release@v0.1.15
        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 }}
@mitchelbaker-cisa mitchelbaker-cisa added the improvement This issue or pull request will add new or improve existing functionality label Feb 27, 2024
@mitchelbaker-cisa mitchelbaker-cisa added this to the Backlog milestone Feb 27, 2024
@mitchelbaker-cisa mitchelbaker-cisa self-assigned this Feb 27, 2024
@safiuddinr safiuddinr added Points: 2 Story Point(6-8 hours) and removed improvement This issue or pull request will add new or improve existing functionality labels May 13, 2024
@safiuddinr safiuddinr removed this from the Backlog milestone May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Points: 2 Story Point(6-8 hours)
Projects
Status: 🆕 Product Backlog
Development

No branches or pull requests

2 participants