From 4cc83dca9b286829fffbd35443b58813cf0e9e02 Mon Sep 17 00:00:00 2001 From: Ravina Dhruve Date: Mon, 28 Aug 2023 15:42:03 -0700 Subject: [PATCH] Update and fix release workflows Change summary: ----------------- 1. Updated the release action to not run build & push docker image step using a dockerfile, since it doesn't seem to be required. 2. The changes are in parity with terraform repo for AWS provider and also the terrafrom repo for GCP provider running cloudbench based installs. --- .github/git-chglog/CHANGELOG.tpl.md | 28 +++++++++++ .github/git-chglog/config.yml | 32 ++++++++++++ .github/workflows/release.yaml | 76 +++++++++++++++++------------ 3 files changed, 104 insertions(+), 32 deletions(-) create mode 100644 .github/git-chglog/CHANGELOG.tpl.md create mode 100644 .github/git-chglog/config.yml diff --git a/.github/git-chglog/CHANGELOG.tpl.md b/.github/git-chglog/CHANGELOG.tpl.md new file mode 100644 index 0000000..a10bacc --- /dev/null +++ b/.github/git-chglog/CHANGELOG.tpl.md @@ -0,0 +1,28 @@ +{{ range .Versions }} +{{ range .CommitGroups -}} +### {{ .Title }} + +{{ range .Commits -}} +* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} + {{ if .Body }}> {{ .Body }} {{ end }} + {{ end }} + {{ end -}} + +{{- if .RevertCommits -}} +### Reverts + +{{ range .RevertCommits -}} +* {{ .Revert.Header }} + {{ end }} + {{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} + +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} \ No newline at end of file diff --git a/.github/git-chglog/config.yml b/.github/git-chglog/config.yml new file mode 100644 index 0000000..dde2704 --- /dev/null +++ b/.github/git-chglog/config.yml @@ -0,0 +1,32 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/sysdiglabs/terraform-google-secure +options: + commits: + # filters: + # Type: + # - feat + # - fix + # - perf + # - refactor + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + ci: Continuous Integration + docs: Documentation + chore: Small Modifications + build: Compilation & Dependencies + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 59005f6..7f8ac57 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,35 +10,47 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Extract tag name - id: tag - run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} - - - name: Create release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: true - prerelease: false - body: | - This is the ${{ github.ref }} release of ${{ env.GITHUB_REPOSITORY }} - - ### Major Changes - ### Minor Changes - ### Bug fixes - - - name: Build and push Docker image - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.SYSDIGLABS_DOCKERHUB_USER }} - password: ${{ secrets.SYSDIGLABS_DOCKERHUB_TOKEN }} - repository: ${{ env.GITHUB_REPOSITORY }} - add_git_labels: true - dockerfile: build/Dockerfile - tags: latest, ${{ steps.tag.outputs.VERSION }} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '^1.15' + + - name: Setup go-chglog + working-directory: /tmp + env: + VERSION: "0.10.0" + run: | + wget https://github.com/git-chglog/git-chglog/releases/download/v${VERSION}/git-chglog_${VERSION}_linux_amd64.tar.gz + gunzip git-chglog_${VERSION}_linux_amd64.tar.gz + tar -xvf git-chglog_${VERSION}_linux_amd64.tar + sudo mv git-chglog /usr/local/bin/ + + - name: Generate changelog + run: git-chglog -c .github/git-chglog/config.yml -o RELEASE_CHANGELOG.md $(git describe --tags $(git rev-list --tags --max-count=1)) + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true + prerelease: false + body_path: RELEASE_CHANGELOG.md + + # Check if we need to build using dockerfile in the release. If yes, uncomment below. + #- name: Build and push Docker image + # uses: docker/build-push-action@v1 + # with: + # username: ${{ secrets.SYSDIGLABS_DOCKERHUB_USER }} + # password: ${{ secrets.SYSDIGLABS_DOCKERHUB_TOKEN }} + # repository: ${{ env.GITHUB_REPOSITORY }} + # add_git_labels: true + # dockerfile: build/Dockerfile + # tags: latest, ${{ steps.tag.outputs.VERSION }}