-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b64e42e
commit 5bdb724
Showing
6 changed files
with
201 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
changelog: | ||
categories: | ||
- title: "Features :star:" | ||
labels: | ||
- "feature" | ||
|
||
- title: "Improvements :arrow_up:" | ||
labels: | ||
- "enhancement" | ||
|
||
- title: "Bugfixes :bug:" | ||
labels: | ||
- "bug" | ||
|
||
- title: "Maintenance :wrench:" | ||
labels: | ||
- "dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
on: [push] | ||
on: [pull_request, push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/checkout@v3 | ||
|
||
- run: sudo apt-get update | ||
|
||
- run: sudo apt-get -y install libcurl4-openssl-dev | ||
|
||
- run: cmake . | ||
|
||
- run: make -j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version number | ||
required: true | ||
|
||
jobs: | ||
image: | ||
name: Publish image to Docker registry | ||
|
||
runs-on: ubuntu-latest | ||
|
||
needs: prepare | ||
|
||
permissions: | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.version }} | ||
|
||
- name: Login to the container registry | ||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | ||
|
||
- name: Download the latest snapshot image for caching | ||
run: docker pull ghcr.io/thepieterdc/mailbridge:latest-snapshot | ||
|
||
- name: Build the new image | ||
run: docker build . -t ghcr.io/thepieterdc/mailbridge:latest -t ghcr.io/thepieterdc/mailbridge:${{ github.event.inputs.version }} --cache-from ghcr.io/thepieterdc/mailbridge:latest-snapshot | ||
|
||
- name: Push the new image | ||
run: docker push -a ghcr.io/thepieterdc/mailbridge | ||
|
||
prepare: | ||
name: Prepare the release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Create a release branch | ||
run: | | ||
git checkout -b release | ||
git push -u origin release | ||
- name: Configure git | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "GitHub Actions" | ||
- name: Set the release version | ||
run: ./scripts/set-version.sh ${{ github.event.inputs.version }} | ||
|
||
- name: Make the release commit | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'CMakeLists.txt' | ||
branch: release | ||
commit: '--signoff' | ||
default_author: github_actions | ||
message: "Release v${{ github.event.inputs.version }}" | ||
tag: ${{ github.event.inputs.version }} | ||
|
||
release: | ||
name: Publish release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
needs: prepare | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: release | ||
|
||
- name: Configure git | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "GitHub Actions" | ||
- name: Create release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
draft: false | ||
prerelease: false | ||
release_name: ${{ github.event.inputs.version }} | ||
tag_name: ${{ github.event.inputs.version }} | ||
|
||
- name: Increase the version | ||
run: ./scripts/increment-version.sh | ||
|
||
- name: Make the next development commit | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'CMakeLists.txt' | ||
branch: release | ||
commit: '--signoff' | ||
default_author: github_actions | ||
message: "Prepare the next development cycle" | ||
|
||
- name: Open a pull request | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
destination_branch: master | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_assignee: thepieterdc | ||
pr_body: Merge the release commits into the main branch. | ||
pr_title: Release v${{ github.event.inputs.version }} | ||
source_branch: release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
usage() { | ||
echo "Syntax: ./scripts/increment-version.sh" | ||
exit 1 | ||
} | ||
|
||
# Get the current version. | ||
version=$(cat CMakeLists.txt | grep "mailbridge VERSION" | grep -o '".*"' | tr -d '"') | ||
|
||
# Strip the optional -SNAPSHOT part. | ||
if echo "$version" | grep -q "\-SNAPSHOT"; then | ||
version=$(echo "$version" | sed "s/-SNAPSHOT//g") | ||
fi | ||
|
||
# Split the version. | ||
major=$(echo "$version" | egrep -o "^[0-9]+") | ||
minor=$(echo "$version" | egrep -o "\.[0-9]+\." | egrep -o "[0-9]+") | ||
bugfix=$(echo "$version" | egrep -o "\.[0-9]+$" | egrep -o "[0-9]+") | ||
|
||
# Increment the bugfix version. | ||
bugfix=$((bugfix+1)) | ||
|
||
# Build the new version. | ||
newversion="$major.$minor.$bugfix-SNAPSHOT" | ||
|
||
# Set the new version. | ||
./scripts/set-version.sh "$newversion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
usage() { | ||
echo "Syntax: ./scripts/set-version.sh 1.0.0" | ||
exit 1 | ||
} | ||
|
||
# Check if the version argument was passed. | ||
if [ "$#" -ne 1 ]; then | ||
usage | ||
fi | ||
|
||
# Replace the version. | ||
sed -i "s/mailbridge VERSION \".*\"/mailbridge VERSION \"$1\"/" CMakeLists.txt |