ci: move from master to main #47
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: Main | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: "Arnaud Deprez" | |
GIT_AUTHOR_EMAIL: "arnaudeprez@gmail.com" | |
GIT_COMMITTER_NAME: "Arnaud Deprez" | |
GIT_COMMITTER_EMAIL: "arnaudeprez@gmail.com" | |
GIT_COMMIT: ${{ github.sha }} | |
steps: | |
- name: Extract Branch Name in GIT_BRANCH env | |
run: | | |
echo "GITHUB_HEAD_REF=${GITHUB_HEAD_REF} & GITHUB_REF=${GITHUB_REF}" | |
if [ -n "$GITHUB_HEAD_REF" ] | |
then | |
echo "GIT_BRANCH=${GITHUB_HEAD_REF#refs/heads/}" >> $GITHUB_ENV | |
else | |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
fi | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.18 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Unshallow git repo | |
run: git fetch --prune --unshallow | |
- name: Build | |
run: make --environment-overrides test-release | |
- name: Test | |
run: make --environment-overrides test-integration | |
- uses: codecov/codecov-action@v1 | |
with: | |
fail_ci_if_error: true # optional (default = false) | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: make --environment-overrides release | |
if: github.event_name != 'pull_request' && (env.GIT_BRANCH == 'main' || startsWith(env.GIT_BRANCH, 'release/')) |