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?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No 

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [x] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* fixes https://github.com/alcionai/corso/issues/1873

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2022-12-24 02:41:49 +05:30 committed by GitHub
parent a9da26d3cc
commit a1444f529e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -398,11 +398,20 @@ jobs:
with: with:
go-version-file: src/go.mod 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 - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4 uses: goreleaser/goreleaser-action@v4
with: with:
version: latest version: latest
args: release --rm-dist --timeout 500m args: release --rm-dist --timeout 500m ${{ env.grflags }}
workdir: src workdir: src
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}