Skip to content

Commit

Permalink
Automate release notes (#442)
Browse files Browse the repository at this point in the history
* Automate release note generation

* Automate github release when deploying to production

* update readme

---------

Co-authored-by: Hammerbeck <andreas.hammerbeck@digdir.no>
  • Loading branch information
Andreass2 and Hammerbeck authored May 23, 2024
1 parent c8c50f5 commit 46c77a6
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .github/actions/get-current-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "Get the current version from a file and the git short sha"
outputs:
version:
description: "Version"
value: ${{ steps.get-current-version.outputs.version }}
value: ${{ steps.set-current-version.outputs.version }}
gitShortSha:
description: "Git short sha"
value: ${{ steps.set-git-short-sha.outputs.gitShortSha }}
Expand All @@ -28,9 +28,8 @@ runs:
id: set-git-short-sha
shell: bash
run: echo "gitShortSha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Set image tag
id: set-image-tag
shell: bash
run: echo "imageTag=$(cat version.txt)-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

37 changes: 37 additions & 0 deletions .github/actions/release-to-git/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create release in github

description: Create a release to git if the version has been bumped in the version.txt file

inputs:
GITHUB_TOKEN:
description: "GitHub token"
required: true
default: ${{ github.token }}

runs:
using: "composite"
steps:
- uses: actions/checkout@v4

- name: Get version
id: get-version
uses: ./.github/actions/get-current-version

- name: fetch tags
shell: bash
run: git fetch --tags

- name: set latest tag
shell: bash
id: set-latest-tag
run: |
echo "latestTag=$(git tag | sort --version-sort | tail -n1)" >> $GITHUB_OUTPUT
- name: Create release
shell: bash
if: ${{ !(steps.set-latest-tag.outputs.latestTag == steps.get-version.outputs.version) }}
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
TAG: ${{ steps.get-version.outputs.version }}
run: |
gh release create "$TAG" --title="v${{steps.get-version.outputs.version}}" --generate-notes --target feat/automatic-release-notes
24 changes: 24 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- kind/breaking-change
- title: New Features 🎉
labels:
- kind/feature
- title: Bugfixes 🐛
labels:
- kind/bug
- title: Other Changes
labels:
- kind/other
- kind/user-story
- title: Dependency Upgrades 📦
labels:
- kind/dependencies
- title: Uncategorized changes
labels:
- "*"
18 changes: 18 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,21 @@ jobs:
hasAzureChanges: ${{ needs.check-for-changes.outputs.hasAzureChanges }}
hasBackendChanges: ${{ needs.check-for-changes.outputs.hasBackendChanges }}
hasMigrationChanges: ${{ needs.check-for-changes.outputs.hasMigrationChanges }}

release-to-git:
name: release to git
runs-on: ubuntu-latest
needs: [check-for-changes, deploy-production]
if: ${{ needs.check-for-changes.outputs.hasBackendChanges == 'true' && !failure() && !cancelled()}}
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: release
if: (!failure() && !cancelled())
uses: ./.github/actions/release-to-git
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion README-infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,7 @@ https://pedia.altinn.cloud/altinn-3/ops/release-and-deploy/api-management/


## After deployment of infrastructure
It's important to check that Microsoft Defender is enabled for all blob storages in the environment.
It's important to check that Microsoft Defender is enabled for all blob storages in the environment.

## Create release notes
If the version in version.txt is bumped, a new release in github will automaticly be created the next time the production environment is deployed.

0 comments on commit 46c77a6

Please sign in to comment.