Skip to content

Commit

Permalink
Update release CI step with conditional tag logic
Browse files Browse the repository at this point in the history
  • Loading branch information
harshalbhatia committed Feb 12, 2022
1 parent 822a0e8 commit 579456f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: GoCI
on:
push:
branches: [ master ]
branches:
tags:
pull_request:
branches: [ master ]

branches:
- master
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -14,7 +15,7 @@ jobs:
# Docker Hub image
image: redis
ports:
- 6379:6379
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
Expand All @@ -29,7 +30,7 @@ jobs:
#POSTGRES_PASSWORD: ipsum-lorem
POSTGRES_DB: postgres
ports:
- 5432:5432
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

Expand All @@ -46,7 +47,10 @@ jobs:

release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}

steps:
- name: Release
run: scripts/release.sh
uses: actions/checkout@v2

- run: ./scripts/release.sh

2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
builds:
- env:
- CGO_ENABLED=0
archive:
archives:
replacements:
darwin: Darwin
linux: Linux
Expand Down
24 changes: 11 additions & 13 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

set -e

if [ -n "$TRAVIS_TAG" ]; then
curl -sL https://git.io/goreleaser | bash
SHA=$(cat dist/checksums.txt | grep Darwin_x86_64 | awk '{ print $1}')
go run scripts/proctor_template.go $TRAVIS_TAG $SHA
rm -rf homebrew-gojek
git clone "https://$GITHUB_TOKEN:@github.com/gojek/homebrew-gojek.git"
cp scripts/proctor.rb homebrew-gojek/Formula/proctor.rb
cd homebrew-gojek
git add .
git commit -m "[TravisCI] updating brew formula for release $TRAVIS_TAG"
git push --force --quiet "https://$GITHUB_TOKEN:@github.com/gojektech/homebrew-gojek.git"
fi

curl -sL https://git.io/goreleaser | bash
SHA=$(cat dist/checksums.txt | grep Darwin_x86_64 | awk '{ print $1}')
echo " REF_NAME => $GITHUB_REF_NAME"
go run scripts/proctor_template.go "$GITHUB_REF_NAME" "$SHA"
rm -rf homebrew-gojek
git clone "https://$GITHUB_TOKEN:@github.com/gojek/homebrew-gojek.git"
cp scripts/proctor.rb homebrew-gojek/Formula/proctor.rb
cd homebrew-gojek
git add .
git commit -m "[GH Actions] updating brew formula for release $GITHUB_REF_NAME"
#git push --force --quiet "https://$GITHUB_TOKEN:@github.com/gojektech/homebrew-gojek.git"

0 comments on commit 579456f

Please sign in to comment.