This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
Bump go.uber.org/zap from 1.24.0 to 1.25.0 (#131) #86
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 and Release | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
test: | |
name: Test/Cover | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19' | |
- name: Go caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ github.job }}-${{ runner.os }}-go- | |
- name: Run test/cover | |
run: WITH_DEPENDENCIES=true make cover | |
env: | |
TEST_OUTPUT_DIR: /tmp/test-results/ | |
COVER_OUTPUT_DIR: /tmp/cover-results/ | |
publish-images: | |
name: Build and publish images | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19' | |
- name: Go caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ github.job }}-${{ runner.os }}-go- | |
- name: Installing ko | |
run: go install github.com/google/[email protected] | |
- name: Login to Docker Hub | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GCR | |
uses: docker/login-action@v2 | |
with: | |
registry: gcr.io | |
username: _json_key | |
password: ${{ secrets.GCLOUD_SERVICEACCOUNT_KEY }} | |
- name: Set IMAGE_TAG | |
id: image-tag | |
run: | | |
IMAGE_TAG=${GITHUB_SHA} | |
[[ ${GITHUB_REF_TYPE} == "tag" ]] && IMAGE_TAG=${GITHUB_REF_NAME} | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT | |
- name: Publish container images to DockerHub | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
env: | |
KO_DOCKER_REPO: docker.io/triggermesh | |
KOFLAGS: --jobs=4 --platform=linux/amd64,linux/arm64,linux/ppc64le --push=${{ github.event_name != 'pull_request' }} | |
DIST_DIR: ./releases/manifests | |
run: | | |
IMAGE_TAG=${{ steps.image-tag.outputs.IMAGE_TAG }} make release | |
- name: Publish container images to GCR | |
env: | |
KO_DOCKER_REPO: gcr.io/triggermesh | |
KOFLAGS: --jobs=4 --platform=linux/amd64,linux/arm64,linux/ppc64le --push=${{ github.event_name != 'pull_request' }} | |
DIST_DIR: ./releases/manifests | |
run: | | |
pushd hack/manifest-cleaner | |
go install . | |
popd | |
IMAGE_TAG=${{ steps.image-tag.outputs.IMAGE_TAG }} make release | |
declare -a release_files=( | |
triggermesh-core-crds.yaml | |
triggermesh-core.yaml | |
) | |
for f in "${release_files[@]}"; do | |
manifest-cleaner <"${DIST_DIR}/${f}" >"${DIST_DIR}/${f}.clean" | |
mv "${DIST_DIR}/${f}.clean" "${DIST_DIR}/${f}" | |
done | |
- name: Upload artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: manifests | |
path: ./releases/manifests | |
retention-days: 14 | |
release: | |
name: Create Release | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: publish-images | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download artifact | |
uses: actions/download-artifact@master | |
with: | |
name: manifests | |
path: ./releases/manifests | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |