-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates/ci): add integration to auto release apps (#1239)
* feat: add integration to auto release apps through the Github CI. * implemented a cli action under actions/cli. * apps will be scaffold with a release workflow using the new starport cli action and other 3rd party actions. * added instructions about how to install an app through the curl+bash installer. * tweak * docs * Apply suggestions from code review Co-authored-by: Denis Fadeev <[email protected]> * fix * Update starport/templates/app/stargate/readme.md.plush Co-authored-by: Denis Fadeev <[email protected]> * create/update "latest" release everytime there is a change to the develop branch * use default branch for "latest" release * tweak * tweak * Update starport/templates/app/stargate/.github/workflows/release.yml Co-authored-by: Denis Fadeev <[email protected]> * Update starport/templates/app/stargate/readme.md.plush Co-authored-by: Denis Fadeev <[email protected]> * Apply suggestions from code review Co-authored-by: Lucas Bertrand <[email protected]> Co-authored-by: Denis Fadeev <[email protected]> Co-authored-by: Lucas Bertrand <[email protected]>
- Loading branch information
1 parent
de13ae2
commit e55a8f5
Showing
11 changed files
with
161 additions
and
67 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,3 @@ | ||
FROM starport/cli:develop | ||
|
||
USER root |
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,5 @@ | ||
name: cli | ||
description: Starport CLI | ||
runs: | ||
using: docker | ||
image: Dockerfile |
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,22 @@ | ||
# Starport CLI Action | ||
This action makes the `starport` CLI available as a Github Action. | ||
|
||
## Quick start | ||
|
||
Add a new workflow to your repo: | ||
|
||
```yml | ||
on: push | ||
|
||
jobs: | ||
help: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Print Help | ||
uses: tendermint/starport/actions/cli@develop | ||
with: | ||
args: -h | ||
``` |
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,50 @@ | ||
name: vars | ||
description: Outputs variables that can be useful while creating a release | ||
outputs: | ||
should_release: | ||
description: Indicates whether a release should be created or not | ||
value: ${{ steps.vars.outputs.should_release }} | ||
is_release_type_latest: | ||
description: Shows if release type is latest (not a v* release) | ||
value: ${{ steps.vars.outputs.is_release_type_latest }} | ||
tag_name: | ||
description: Name of the tag that should be used for release | ||
value: ${{ steps.vars.outputs.tag_name }} | ||
tarball_prefix: | ||
description: A prefix to use in tarball asset names | ||
value: ${{ steps.vars.outputs.tarball_prefix }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: vars | ||
run: | | ||
repo_name=${GITHUB_REPOSITORY##*/} | ||
ref_name=${GITHUB_REF##*/} | ||
default_branch=$(git remote show origin | awk '/HEAD branch/ {print $NF}') | ||
should_release=true | ||
is_release_type_latest=false | ||
tag_name="" | ||
if [[ $GITHUB_REF == refs/tags/* ]] | ||
then | ||
tag_name=$ref_name | ||
elif [[ $GITHUB_REF == refs/heads/* && $ref_name == $default_branch ]] | ||
then | ||
tag_name=latest | ||
is_release_type_latest=true | ||
else | ||
should_release=false | ||
fi | ||
echo ::set-output name=should_release::$should_release | ||
echo ::set-output name=is_release_type_latest::$is_release_type_latest | ||
echo ::set-output name=tag_name::$tag_name | ||
echo ::set-output name=tarball_prefix::"$repo_name"_$tag_name | ||
shell: bash | ||
- run: | | ||
echo "- should_release: ${{ steps.vars.outputs.should_release }}" | ||
echo "- is_release_type_latest: ${{ steps.vars.outputs.is_release_type_latest }}" | ||
echo "- tag_name: ${{ steps.vars.outputs.tag_name }}" | ||
echo "- tarball_prefix: ${{ steps.vars.outputs.tarball_prefix }}" | ||
shell: bash |
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
39 changes: 0 additions & 39 deletions
39
starport/templates/app/stargate/.github/workflows/build.yml.plush
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
starport/templates/app/stargate/.github/workflows/pages.yml
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
starport/templates/app/stargate/.github/workflows/release.yml
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,51 @@ | ||
# This workflow is useful if you want to automate the process of: | ||
# | ||
# a) Creating a new prelease when you push a new tag with a "v" prefix (version). | ||
# | ||
# This type of prerelease is meant to be used for production: alpha, beta, rc, etc. types of releases. | ||
# After the prerelease is created, you need to make your changes on the release page at the relevant | ||
# Github page and publish your release. | ||
# | ||
# b) Creating/updating the "latest" prerelease when you push to your default branch. | ||
# | ||
# This type of prelease is useful to make your bleeding-edge binaries available to advanced users. | ||
# | ||
# The workflow will not run if there is no tag pushed with a "v" prefix and no change pushed to your | ||
# default branch. | ||
on: push | ||
|
||
jobs: | ||
might_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Prepare Release Variables | ||
id: vars | ||
uses: tendermint/starport/actions/release/vars@develop | ||
|
||
- name: Issue Release Assets | ||
uses: tendermint/starport/actions/cli@develop | ||
if: ${{ steps.vars.outputs.should_release == 'true' }} | ||
with: | ||
args: build --release --release.prefix ${{ steps.vars.outputs.tarball_prefix }} -t linux:amd64 -t linux:arm64 -t darwin:amd64 -t darwin:arm64 | ||
|
||
- name: Delete the "latest" Release | ||
uses: dev-drprasad/[email protected] | ||
if: ${{ steps.vars.outputs.is_release_type_latest == 'true' }} | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag_name }} | ||
delete_release: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish the Release | ||
uses: softprops/action-gh-release@v1 | ||
if: ${{ steps.vars.outputs.should_release == 'true' }} | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag_name }} | ||
files: release/* | ||
prerelease: true | ||
env: | ||
GITHUB_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