|
| 1 | +name: Create Container |
| 2 | + |
| 3 | +# This workflow uses actions that are not certified by GitHub. |
| 4 | +# They are provided by a third-party and are governed by |
| 5 | +# separate terms of service, privacy policy, and support |
| 6 | +# documentation. |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [ "main" ] |
| 11 | + # Publish semver tags as releases. |
| 12 | + tags: [ 'v*.*.*' ] |
| 13 | + paths-ignore: |
| 14 | + - 'manifests/**' |
| 15 | + - 'README.md' |
| 16 | + |
| 17 | +env: |
| 18 | + REGISTRY: quay.io |
| 19 | + IMAGE_NAME: powercloud/power-dra-driver |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + packages: write |
| 27 | + id-token: write |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Setup Go 1.23.x |
| 34 | + uses: actions/setup-go@v5 |
| 35 | + with: |
| 36 | + go-version: '1.23.x' |
| 37 | + # Eventually we should build inline... |
| 38 | + |
| 39 | + - name: Build the binaries |
| 40 | + run: | |
| 41 | + GOOS=linux GOARCH=ppc64le go build -o bin/power-dev-plugin-ppc64le cmd/power-dev-plugin/main.go |
| 42 | +
|
| 43 | + # Install the cosign tool except on PR |
| 44 | + # https://github.com/sigstore/cosign-installer |
| 45 | + - name: Install cosign |
| 46 | + if: github.event_name != 'pull_request' |
| 47 | + |
| 48 | + with: |
| 49 | + cosign-release: 'v2.4.1' |
| 50 | + |
| 51 | + # Workaround: https://github.com/docker/build-push-action/issues/461 |
| 52 | + - name: Setup Docker buildx |
| 53 | + uses: docker/setup-buildx-action@v3 |
| 54 | + |
| 55 | + # Login against a Docker registry except on PR |
| 56 | + # https://github.com/docker/login-action |
| 57 | + - name: Log into registry ${{ env.REGISTRY }} |
| 58 | + if: github.event_name != 'pull_request' |
| 59 | + uses: docker/login-action@v3 |
| 60 | + with: |
| 61 | + registry: quay.io |
| 62 | + username: ${{ secrets.QUAY_USER }} |
| 63 | + password: ${{ secrets.QUAY_TOKEN }} |
| 64 | + |
| 65 | + # Extract metadata (tags, labels) for Docker |
| 66 | + # https://github.com/docker/metadata-action |
| 67 | + - name: Extract Docker metadata |
| 68 | + id: meta |
| 69 | + uses: docker/metadata-action@v5 |
| 70 | + with: |
| 71 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 72 | + |
| 73 | + # Build and push Docker image with Buildx (don't push on PR) |
| 74 | + # https://github.com/docker/build-push-action |
| 75 | + - name: Build and push Docker image |
| 76 | + id: build-and-push |
| 77 | + uses: docker/build-push-action@v5 |
| 78 | + with: |
| 79 | + context: . |
| 80 | + platforms: linux/ppc64le |
| 81 | + file: build/Containerfile-build |
| 82 | + push: ${{ github.event_name != 'pull_request' }} |
| 83 | + tags: ${{ steps.meta.outputs.tags }} |
| 84 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments