|
| 1 | +# This workflow will build the CodeFlare Operator image and push it to the project-codeflare image registry |
| 2 | + |
| 3 | +name: Tag and Release |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'Tag to be used for operator image' |
| 9 | + required: true |
| 10 | + default: '0.0.0-dev' |
| 11 | + replaces: |
| 12 | + description: 'The previous semantic version that this tag replaces.' |
| 13 | + required: true |
| 14 | + default: '0.0.0-dev' |
| 15 | + |
| 16 | +jobs: |
| 17 | + push: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Activate cache |
| 23 | + uses: actions/cache@v2 |
| 24 | + with: |
| 25 | + path: /cache |
| 26 | + key: ${{ runner.os }}-cache-${{ hashFiles('**/go.sum', '.pre-commit-config.yaml') }} |
| 27 | + |
| 28 | + - name: Create tag |
| 29 | + uses: actions/github-script@v6 |
| 30 | + with: |
| 31 | + script: | |
| 32 | + github.rest.git.createRef({ |
| 33 | + owner: context.repo.owner, |
| 34 | + repo: context.repo.repo, |
| 35 | + ref: 'refs/tags/${{ github.event.inputs.version }}', |
| 36 | + sha: context.sha |
| 37 | + }) |
| 38 | +
|
| 39 | + - name: Install operator-sdk |
| 40 | + run: make install-operator-sdk |
| 41 | + |
| 42 | + - name: Login to Quay.io |
| 43 | + uses: redhat-actions/podman-login@v1 |
| 44 | + with: |
| 45 | + username: ${{ secrets.QUAY_ID }} |
| 46 | + password: ${{ secrets.QUAY_TOKEN }} |
| 47 | + registry: quay.io |
| 48 | + |
| 49 | + - name: Login to Red Hat Registry |
| 50 | + uses: redhat-actions/podman-login@v1 |
| 51 | + with: |
| 52 | + username: ${{ secrets.RH_REG_ID }} |
| 53 | + password: ${{ secrets.RH_REG_TOKEN }} |
| 54 | + registry: registry.redhat.io |
| 55 | + |
| 56 | + - name: Image Build |
| 57 | + run: | |
| 58 | + make build |
| 59 | + make bundle |
| 60 | + make image-build -e IMG=quay.io/project-codeflare/codeflare-operator:${SOURCE_TAG} |
| 61 | + podman tag quay.io/project-codeflare/codeflare-operator:${SOURCE_TAG} quay.io/project-codeflare/codeflare-operator:latest |
| 62 | + env: |
| 63 | + SOURCE_TAG: ${{ github.event.inputs.version }} |
| 64 | + |
| 65 | + - name: Image Push |
| 66 | + run: | |
| 67 | + make image-push -e IMG=quay.io/project-codeflare/codeflare-operator:${SOURCE_TAG} |
| 68 | + make image-push -e IMG=quay.io/project-codeflare/codeflare-operator:latest |
| 69 | + env: |
| 70 | + SOURCE_TAG: ${{ github.event.inputs.version }} |
0 commit comments