mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-05-25 00:21:35 +00:00
* Don't attempt to publish docker images on forks When the Main CI workflow runs on a fork, the docker push step will always fail because the appropriate secrets are missing. This is annoying at best and causes CI on forks to be untrustworthy at worst. Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Use single quotes for string, as github expects Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
44 lines
944 B
YAML
44 lines
944 B
YAML
name: Main CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set up Go 1.14
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.14
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: crazy-max/ghaction-docker-buildx@v3
|
|
with:
|
|
buildx-version: latest
|
|
qemu-version: latest
|
|
|
|
- name: Build
|
|
run: make local
|
|
|
|
- name: Test
|
|
run: make test
|
|
|
|
# Only try to publish the container image from the root repo; forks don't have permission to do so and will always get failures.
|
|
- name: Publish container image
|
|
if: github.repository == 'vmware-tanzu/velero'
|
|
run: |
|
|
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
|
|
./hack/docker-push.sh
|