From a1444f529e1ba0692be47fee231c0d3f539aa93d Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Sat, 24 Dec 2022 02:41:49 +0530 Subject: [PATCH] Make snapshot release in goreleaser if from main (#1899) ## Description This makes sure we switch between `--snapshot` and regular release based of we are doing it from main branch. ## Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No ## Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Test - [x] :computer: CI/Deployment - [ ] :hamster: Trivial/Minor ## Issue(s) * fixes https://github.com/alcionai/corso/issues/1873 ## Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9b8d8353..5bd7dbd40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -398,11 +398,20 @@ jobs: with: go-version-file: src/go.mod + - name: Decide goreleaser release mode + shell: bash + run: | + if test '${{ github.ref }}' = "refs/heads/main"; then + echo "grflags=--snapshot" >> $GITHUB_ENV + else + echo "grflags=" >> $GITHUB_ENV + fi + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: version: latest - args: release --rm-dist --timeout 500m + args: release --rm-dist --timeout 500m ${{ env.grflags }} workdir: src env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}