-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically release
obs-installer
binaries with incremental semve…
…r autotagging. (#319) Automatic release semver obs-installer binary
- Loading branch information
1 parent
6b1a56d
commit 38c307d
Showing
3 changed files
with
84 additions
and
0 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,49 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
golang-version: "1.19" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
# https://github.com/PaulHatch/semantic-version | ||
- id: semver | ||
uses: paulhatch/semantic-version@v4 | ||
with: | ||
# The prefix to use to identify tags | ||
tag_prefix: "v" | ||
# A string which, if present in a git commit, indicates that a change represents a | ||
# major (breaking) change, supports regular expressions wrapped with '/' | ||
major_pattern: "(MAJOR)" | ||
# Same as above except indicating a minor change, supports regular expressions wrapped with '/' | ||
minor_pattern: "(MINOR)" | ||
# A string to determine the format of the version output | ||
format: "${major}.${minor}.${patch}-prerelease${increment}" | ||
# Optional path to check for changes. If any changes are detected in the path the | ||
# 'changed' output will true. Enter multiple paths separated by spaces. | ||
change_path: "installer/" | ||
# If this is set to true, *every* commit will be treated as a new version. | ||
bump_each_commit: false | ||
- uses: actions/setup-go@v2 | ||
if: ${{steps.semver.outputs.changed}} | ||
with: | ||
go-version: ${{ env.golang-version }} | ||
- name: Build artifacts | ||
if: ${{steps.semver.outputs.changed}} | ||
run: VERSION=${{steps.semver.outputs.version_tag}} ./hack/build-obs-installer.sh | ||
# https://github.com/softprops/action-gh-release | ||
- uses: softprops/action-gh-release@v1 | ||
if: ${{steps.semver.outputs.changed}} | ||
with: | ||
tag_name: ${{steps.semver.outputs.version_tag}} | ||
generate_release_notes: true | ||
fail_on_unmatched_files: true | ||
files: ./installer/*.tar.gz |
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,33 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC2034 | ||
|
||
set -euo pipefail | ||
|
||
SCRIPT_PATH=$(realpath "$(dirname "$0")") | ||
PROJECT_ROOT=$(realpath "${SCRIPT_PATH}/../") | ||
|
||
INSTALLER_DIR="${PROJECT_ROOT}/installer" | ||
BINARY_NAME="obs-installer" | ||
|
||
if [ -z ${VERSION+x} ]; then | ||
echo "Must supply VERSION" | ||
fi | ||
|
||
pushd "${INSTALLER_DIR}" | ||
|
||
for GOOS in darwin linux; do | ||
for GOARCH in arm64 amd64; do | ||
export GOOS=$GOOS | ||
export GOARCH=$GOARCH | ||
|
||
RELEASE_NAME="${BINARY_NAME}_${VERSION}_${GOOS}_${GOARCH}.tar.gz" | ||
echo "Building ${RELEASE_NAME}" | ||
|
||
go build -o ${BINARY_NAME} . | ||
tar cf "${RELEASE_NAME}" ${BINARY_NAME} | ||
rm "${BINARY_NAME}" | ||
done | ||
done | ||
|
||
popd |