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

automate release notes #442

Merged
merged 31 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading