Merge pull request #263 from coveooss/chore/DT-5645/devportal-onboarding #133
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
name: Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18 | |
id: go | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
env: | |
CGO_ENABLED: 0 | |
run: go build -v | |
- name: Run Tests | |
run: | | |
bash ./test.sh | |
# note: codecov action is disallowed per organization policy | |
# - name: Upload to codecov | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: ./coverage.txt | |
# fail_ci_if_error: true | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Latest | |
if: github.ref == 'refs/heads/main' | |
run: | | |
docker build . -t ghcr.io/coveooss/credentials-sync:latest | |
docker push ghcr.io/coveooss/credentials-sync:latest | |
- name: Build Tag | |
if: github.ref != 'refs/heads/main' | |
run: | | |
export tag=$(cut -d'/' -f3 <<<'${{ github.ref }}') | |
docker build . -t ghcr.io/coveooss/credentials-sync:$tag | |
docker push ghcr.io/coveooss/credentials-sync:$tag | |
- name: Push release | |
if: github.ref != 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl -sL https://git.io/goreleaser | bash; |