-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifies the detection logic and adds github actions to auto-release
- Loading branch information
1 parent
a311d39
commit 751e6ab
Showing
8 changed files
with
156 additions
and
26 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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
function main() { | ||
local previous tag | ||
previous="$(git describe --tags "$(git rev-list --tags --max-count=1)")" | ||
tag="$(printf "%s" "$previous" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')" | ||
|
||
printf "v%s" "${tag#v}" | ||
} | ||
|
||
main "${@:-}" |
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,94 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Run Unit Tests | ||
run: ./scripts/unit.sh | ||
|
||
integration: | ||
name: Integration Tests | ||
runs-on: ubuntu-latest | ||
needs: unit | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Run Integration Tests | ||
run: ./scripts/integration.sh | ||
env: | ||
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: integration | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Tag | ||
id: tag | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
TAG="$(./.github/util/tag.sh)" | ||
echo "::set-output name=tag::$TAG" | ||
- name: Package | ||
env: | ||
TAG: ${{ steps.tag.outputs.tag }} | ||
run: PACKAGE_DIR=artifact ./scripts/package.sh --version "${TAG}" --archive | ||
- name: Create Release Notes | ||
id: create-release-notes | ||
run: | | ||
mkdir -p "${HOME}/bin" | ||
export PATH="${PATH}:${HOME}/bin" | ||
curl "https://github.com/cloudfoundry/packit/releases/download/v0.0.4/jam-linux" \ | ||
--silent \ | ||
--location \ | ||
--output "${HOME}/bin/jam" | ||
chmod +x "${HOME}/bin/jam" | ||
RELEASE_BODY=$(jam summarize --buildpack "${PWD}/artifact.tgz" --format markdown) | ||
# Coz of this messed up issue | ||
# https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372#M3322 | ||
RELEASE_BODY="${RELEASE_BODY//'%'/'%25'}" | ||
RELEASE_BODY="${RELEASE_BODY//$'\n'/'%0A'}" | ||
RELEASE_BODY="${RELEASE_BODY//$'\r'/'%0D'}" | ||
echo "::set-output name=release_body::$RELEASE_BODY" | ||
- name: Create Release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tag.outputs.tag }} | ||
release_name: ${{ steps.tag.outputs.tag }} | ||
body: ${{ steps.create-release-notes.outputs.release_body }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: artifact.tgz | ||
asset_name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz | ||
asset_content_type: application/gzip | ||
|
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,37 @@ | ||
name: Test Pull Request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Run Unit Tests | ||
run: ./scripts/unit.sh | ||
|
||
integration: | ||
name: Integration Tests | ||
runs-on: ubuntu-latest | ||
needs: unit | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Run Integration Tests | ||
run: ./scripts/integration.sh | ||
env: | ||
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
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