|
| 1 | +name: pull request |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + - main |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + name: build |
| 11 | + steps: |
| 12 | + |
| 13 | + - name: set repo name |
| 14 | + shell: bash |
| 15 | + run: | |
| 16 | + echo "REPOSITORY_NAME=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_ENV |
| 17 | +
|
| 18 | + - name: Set up Go 1.x |
| 19 | + uses: actions/setup-go@v2 |
| 20 | + with: |
| 21 | + go-version: ^1.16 |
| 22 | + - name: Check out code into the Go module directory |
| 23 | + uses: actions/checkout@v2 |
| 24 | + |
| 25 | + # - uses: shivanshs9/setup-k8s-operator-sdk@v1 |
| 26 | + # with: |
| 27 | + # version: "1.9.0" # The operator-sdk version to download (if necessary) and use. |
| 28 | + |
| 29 | + - name: Download operator sdk |
| 30 | + shell: bash |
| 31 | + env: |
| 32 | + RELEASE_VERSION: v1.9.0 |
| 33 | + run: | |
| 34 | + curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk_linux_amd64 |
| 35 | + chmod +x operator-sdk_linux_amd64 |
| 36 | + mkdir ${HOME}/bin |
| 37 | + mv operator-sdk_linux_amd64 ${HOME}/bin/operator-sdk |
| 38 | + echo "${HOME}/bin" >> $GITHUB_PATH |
| 39 | +
|
| 40 | + - name: build code |
| 41 | + shell: bash |
| 42 | + run: make VERSION=latest |
| 43 | + |
| 44 | + - name: build bundle |
| 45 | + shell: bash |
| 46 | + run: make bundle IMG=quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY):0.0.1 VERSION=0.0.1 DEFAULT_CHANNEL=alpha |
| 47 | + |
| 48 | + - name: verify bundle |
| 49 | + shell: bash |
| 50 | + run: operator-sdk bundle validate ./bundle --select-optional name=operatorhub |
| 51 | + |
| 52 | + - name: build chart |
| 53 | + shell: bash |
| 54 | + run: make helmchart VERSION=0.0.1 IMG=quay.io/${{ github.repository_owner }}/$(basename $GITHUB_REPOSITORY):0.0.1 |
| 55 | + |
| 56 | + - name: Set up QEMU |
| 57 | + uses: docker/setup-qemu-action@v1 |
| 58 | + with: |
| 59 | + platforms: all |
| 60 | + |
| 61 | + - name: Set up Docker Buildx |
| 62 | + uses: docker/setup-buildx-action@v1 |
| 63 | + |
| 64 | + - name: "Build Operator Image" |
| 65 | + uses: docker/build-push-action@v2 |
| 66 | + with: |
| 67 | + context: . |
| 68 | + file: ./Dockerfile |
| 69 | + platforms: linux/amd64,linux/arm64,linux/ppc64le |
| 70 | + push: false |
| 71 | + tags: "quay.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}:v0.0.1" |
| 72 | + |
| 73 | + - name: "Build Bundle Image" |
| 74 | + uses: docker/build-push-action@v2 |
| 75 | + with: |
| 76 | + context: . |
| 77 | + file: ./bundle.Dockerfile |
| 78 | + platforms: linux/amd64,linux/arm64,linux/ppc64le |
| 79 | + push: false |
| 80 | + tags: "quay.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}-bundle:0.0.1" |
0 commit comments