Skip to content

Commit

Permalink
Possible enhancement - Add changelog for this repo for automating rel…
Browse files Browse the repository at this point in the history
…ease tags. ❤️☕️💡 (#177)

* Add changelog for this repo for automating release branch.

---------

Co-authored-by: Tatsinnit <Tatsinnit@users.noreply.github.com>
  • Loading branch information
Tatsinnit and Tatsinnit authored Jan 31, 2023
1 parent 1099683 commit 14dc89e
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Release
on:
workflow_dispatch:
release:
types: [created]

jobs:
build:
Expand Down Expand Up @@ -93,12 +91,40 @@ jobs:
sha256sum kubelogin-linux-amd64.zip > kubelogin-linux-amd64.zip.sha256
sha256sum kubelogin-linux-arm64.zip > kubelogin-linux-arm64.zip.sha256
# Read changelog and read versions etc.
- name: Check version is mentioned in Changelog.md
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_depth: 10
path: 'CHANGELOG.md'
# Check if the newest tag already exists
- name: Check if tag exist
uses: mukunku/tag-exists-action@5dfe2bf779fe5259360bb10b2041676713dcc8a3 # v1.1.0
id: check-tag-exists
with:
tag: "v${{ steps.changelog_reader.outputs.version }} release" # following the pattern of vx.x.xx release used in this repo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create Release with artifacts
- name: Create Kubelogin Release
id: create_release
if: ${{ steps.check-tag-exists.outputs.exists == 'false'}}
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name : "v${{ steps.changelog_reader.outputs.version }}"
name: "v${{ steps.changelog_reader.outputs.version }} release" # following the pattern of vx.x.xx release used in this repo
body: ${{ steps.changelog_reader.outputs.changes }}

- name: Publish
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: kubelogin.zip kubelogin-win-amd64.zip kubelogin-darwin-amd64.zip kubelogin-darwin-arm64.zip kubelogin-linux-amd64.zip kubelogin-linux-arm64.zip kubelogin.zip.sha256 kubelogin-win-amd64.zip.sha256 kubelogin-darwin-amd64.zip.sha256 kubelogin-darwin-arm64.zip.sha256 kubelogin-linux-amd64.zip.sha256 kubelogin-linux-arm64.zip.sha256
releaseId: ${{ steps.create_release.outputs.id }}

- name: Publish to Snap Store
uses: snapcore/action-publish@v1
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Change Log

## [x.x.xx] --> next will be [0.0.26]

### Whats Changed

- // Todo - > Add some feature et. al. description here.
- // Todo - > Add some fixes et. al. description here.
- // Todo - > Add other changes description here.

### New Contributors

- // Todo - > New contrinutors, thanks et. al. here.
6 changes: 6 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Kubelogin

## Maintenance

* [How to release](maintenance/README.md)

26 changes: 26 additions & 0 deletions docs/maintenance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## How to Release

To make a new release and publish please follow the following steps.

1. Create a branch `publish-x.y.z`
2. Add a section to `CHANGELOG.md` with the header `## [x.y.z]` (N.B: make sure to write the new version in square brackets as the `changelog-reader` action only works if the `CHANGELOG.md` file follows the [Keep a Changelog standard](https://github.com/olivierlacan/keep-a-changelog))
3. Create a new PR, get approval and merge
4. Run the `release` workflow manually from the GH Actions tab

### Sample Changelog content for first release.

For first release using new release and publish using changelog here is a sample:

```
## [0.0.26]
* What is getting released here + @commit
Thanks to whoever was involved, pm.
```

### In Event of Special Case Failures Post Build and Release.

In an event where build and release were successful but publish failed for something else, in that case please make sure we delete the unsucessful release note and release tag, before re-running the release again, this will get release fresh release notes and tag.

0 comments on commit 14dc89e

Please sign in to comment.