-
Notifications
You must be signed in to change notification settings - Fork 19
Automate release #461
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
Merged
Merged
Automate release #461
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
ed3dcc0
test
Trojan295 0913ebe
add script for release
Trojan295 d6785b5
fix permissions
Trojan295 09e07d4
setup git
Trojan295 be035d4
add permissions
Trojan295 14708cb
remove modifying workflow
Trojan295 6830c08
push stuff
Trojan295 1399c11
use PAT and envs
Trojan295 bca2983
fix
Trojan295 fea2ff7
rework
Trojan295 d5b1dbe
commentout tests
Trojan295 5c119f3
fix
Trojan295 614e4d4
add tags build trigger to main build
Trojan295 c81f69d
fix workflows
Trojan295 8f768a9
fix
Trojan295 a743660
rework
Trojan295 6c19a03
commit
95749f3
Prepare 0.5.0 release
d2f8f3b
test
e5e2c3e
revert versions
8faadd8
single workflow
dba18ea
dont tag in prerelease
08f5c61
short build time
294e7ee
fix
2b77818
Update CHANGELOG.md [skip ci]
d4b25b6
Update CHANGELOG.md [skip ci]
b350201
Update CHANGELOG.md [skip ci]
44d0c3a
add gren
456a30a
Make bugfix
Trojan295 b463351
Add super feature
Trojan295 c9549ba
Prepare 0.5.0 release
7ecb88d
simplify
Trojan295 9e3a97e
Revert "Prepare 0.5.0 release"
Trojan295 e01735c
add GCS creds
Trojan295 4e79b04
login to ghrc registry
Trojan295 39c4d13
change gren template
Trojan295 22c93f6
upx and all arch
Trojan295 84a89e9
remove arch
Trojan295 62bfaa4
fix to work in release-branch
Trojan295 99e7796
short build
Trojan295 00f34e4
adjustments for upstream
Trojan295 c6b7f69
fixes
Trojan295 cfaa7b5
fixes
Trojan295 ab40c27
fixes
Trojan295 23a6e29
fixes, trigger CI
Trojan295 9f03df4
rename PAT env
Trojan295 b522c7f
fix
Trojan295 374afab
fix creds issue
Trojan295 f02e60b
after review
Trojan295 8b8f9f7
add permissions
Trojan295 0590ba5
Merge branch 'main' into automate-release
Trojan295 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,66 @@ | ||
name: Make release | ||
|
||
# Required secrets: | ||
# GCS_CREDS - Credentials to Google Cloud Storage for binary and chart releases | ||
# GH_PAT - GitHub username with personal access token with permissions to make commits to repository, must be in format "<username>:<PAT>" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version in SemVer (e.g. '0.5.0') | ||
required: true | ||
|
||
jobs: | ||
make-release: | ||
name: Make release | ||
runs-on: ubuntu-latest | ||
environment: Release | ||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: read | ||
mszostok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
issues: read | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
- name: Setup Git credentials | ||
# Replacing the GH Action token with PAT is required to trigger the branch-build workflow on a commit: | ||
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token | ||
run: | | ||
git remote remove origin | ||
git remote add origin https://${{secrets.GH_PAT}}@github.com/${{github.repository}}.git | ||
mszostok marked this conversation as resolved.
Show resolved
Hide resolved
mszostok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
git config --global user.email "contact@capact.io" | ||
git config --global user.name "Capact Bot" | ||
- name: Setup environment | ||
run: | | ||
. ./hack/ci/setup-env.sh | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{env.GO_VERSION}} | ||
- name: Set up GoReleaser | ||
run: go install github.com/goreleaser/goreleaser@v0.173.2 | ||
- name: Set up GCS | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
service_account_key: ${{ secrets.GCS_CREDS }} | ||
export_default_credentials: true | ||
- name: Log into registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
- name: Push release commits and tag | ||
env: | ||
RELEASE_VERSION: "${{ github.event.inputs.version }}" | ||
run: ./hack/make-release.sh | ||
- name: Run GoReleaser | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make release-binaries | ||
- name: Generate release notes | ||
run: | | ||
npm install -g github-release-notes | ||
gren release -d -T "${{ secrets.GITHUB_TOKEN }}" --tags "v${{ github.event.inputs.version }}" --override | ||
- name: Release Helm charts | ||
run: make release-charts |
This file contains hidden or 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 hidden or 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,8 @@ | ||
dataSource: prs | ||
groupBy: | ||
"🚨 Breaking": [breaking] | ||
"🔧 Bug Fixes": [bug] | ||
"🚀 Enhancements": [enhancement] | ||
template: | ||
issue: "- {{name}} [{{text}}]({{url}}) ([@{{user_login}}]({{user_url}}))" | ||
group: "\n### {{heading}}\n" |
This file contains hidden or 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,71 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
mszostok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
CURRENT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
REPO_ROOT_DIR=$(cd "${CURRENT_DIR}/.." && pwd) | ||
readonly CURRENT_DIR | ||
readonly REPO_ROOT_DIR | ||
|
||
|
||
release::update_helm_charts_version() { | ||
local -r release_version="$1" | ||
local -r deploy_dir="${REPO_ROOT_DIR}/deploy/kubernetes/charts" | ||
|
||
for d in "${deploy_dir}"/*/ ; do | ||
sed -i.bak "s/^version: .*/version: ${release_version}/g" "${d}/Chart.yaml" | ||
done | ||
} | ||
|
||
release::make_prepare_release_commit() { | ||
local -r version="$1" | ||
local -r branch="$2" | ||
|
||
git add . | ||
git commit -m "Prepare ${version} release" | ||
git push origin "${branch}" | ||
} | ||
|
||
release::set_capact_images_in_charts() { | ||
local -r image_tag="$1" | ||
sed -E -i.bak "s/overrideTag: \".+\"/overrideTag: \"${image_tag}\"/g" "${REPO_ROOT_DIR}/deploy/kubernetes/charts/capact/values.yaml" | ||
} | ||
|
||
release::set_hub_manifest_source_branch() { | ||
local -r branch="$1" | ||
sed -E -i.bak "s/branch: .+/branch: ${branch}/g" "${REPO_ROOT_DIR}/deploy/kubernetes/charts/capact/charts/hub-public/values.yaml" | ||
} | ||
|
||
release::make_release_commit() { | ||
local -r version="$1" | ||
local -r release_branch="$2" | ||
local -r tag="v${version}" | ||
|
||
git add . | ||
git commit -m "Set fixed Capact image tag and Populator source branch" | ||
git tag "${tag}" | ||
git push origin "${release_branch}" | ||
git push origin "${tag}" | ||
} | ||
|
||
# required inputs: | ||
# RELEASE_VERSION - new version in SemVer format: x.y.z | ||
[ -z "${RELEASE_VERSION}" ] && echo "Need to set RELEASE_VERSION" && exit 1; | ||
|
||
SOURCE_BRANCH="$(git rev-parse --abbrev-ref HEAD)" | ||
RELEASE_VERSION_MAJOR_MINOR="$(echo "${RELEASE_VERSION}" | sed -E 's/([0-9]+\.[0-9])\.[0-9]/\1/g')" | ||
RELEASE_BRANCH="release-${RELEASE_VERSION_MAJOR_MINOR}" | ||
|
||
main() { | ||
release::update_helm_charts_version "${RELEASE_VERSION}" | ||
release::make_prepare_release_commit "${RELEASE_VERSION}" "${SOURCE_BRANCH}" | ||
|
||
local -r capact_image_tag=$(git rev-parse --short HEAD | sed 's/.$//') | ||
git checkout -B "${RELEASE_BRANCH}" | ||
|
||
release::set_capact_images_in_charts "${capact_image_tag}" | ||
release::set_hub_manifest_source_branch "${RELEASE_BRANCH}" | ||
release::make_release_commit "${RELEASE_VERSION}" "${RELEASE_BRANCH}" | ||
} | ||
|
||
main |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.