Merge pull request #217 from qiuming-best/upload-config #166
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 CI | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release-**' | |
tags: | |
- '*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21' | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build | |
run: make local | |
- name: Test | |
run: make test | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
# Use the JSON key in secret to login gcr.io | |
- uses: 'docker/login-action@v2' | |
with: | |
registry: 'gcr.io' # or REGION.docker.pkg.dev | |
username: '_json_key' | |
password: '${{ secrets.GCR_SA_KEY }}' | |
# 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-plugin-for-csi' | |
run: | | |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | |
./hack/docker-push.sh |