Skip to content

Commit

Permalink
Release pipeline (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefMa authored Jul 30, 2024
1 parent 214ea35 commit ab52658
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
workflow_call:

jobs:
fetchGitHubIssue:
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'The version of the release'
required: true

jobs:
tests:
uses: ./.github/workflows/integration_tests.yml
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [tests]
steps:
- name: Validate version
run: |
SEMVER_REGEX_WITH_LEADING_V="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
if [[ ! "${{ github.event.inputs.version }}" =~ $SEMVER_REGEX_WITH_LEADING_V ]]; then
echo "Invalid version format. Please use a valid semver version, prefixed with 'v'."
exit 1
fi
- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Build for MacOS
run: |
GOOS=darwin GOARCH=amd64 go build -o summaraizer-macos-amd64 cmd/summaraizer/summaraizer.go
GOOS=darwin GOARCH=arm64 go build -o summaraizer-macos-arm64 cmd/summaraizer/summaraizer.go
- name: Build for Linux
run: GOOS=linux GOARCH=amd64 go build -o summaraizer-linux-amd64 cmd/summaraizer/summaraizer.go

- name: Build for Windows
run: GOOS=windows GOARCH=amd64 go build -o summaraizer-windows-amd64 cmd/summaraizer/summaraizer.go

- name: Setup git
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "GitHub Actions [Bot]"
- name: Create tag
run: git tag -a -m ${{ github.event.inputs.version }} ${{ github.event.inputs.version }}

- name: Push tag
run: git push origin ${{ github.event.inputs.version }}

- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
summaraizer-macos-amd64
summaraizer-macos-arm64
summaraizer-linux-amd64
summaraizer-windows-amd64
fail_on_unmatched_files: true
name: ${{ github.event.inputs.version }}
tag_name: ${{ github.event.inputs.version }}
generate_release_notes: true
draft: true
prerelease: true
16 changes: 16 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Release

The release process is fully automated via GitHub Actions.
To dispatch a release, go to the Actions tab and select the ["Release" workflow](https://github.com/ioki-mobility/summaraizer/actions/workflows/release.yml).
Click on the "Run workflow" button and fill in the tag name.
The workflow will then do the following:
* Run integration tests
* Build the CLI binaries for Linux (amd64), macOS (amd64, arm64), and Windows (amd64)
* Create a git tag with the specified tag name
* Create a GitHub release and publish it with an automatically generated changelog

It will create a draft release by default, so you can review the changelog before publishing it.

## Tag name

Please follow the [Go module versioning scheme](https://go.dev/doc/modules/version-numbers) for the tag name.

0 comments on commit ab52658

Please sign in to comment.