|
4 | 4 | workflow_dispatch:
|
5 | 5 | inputs:
|
6 | 6 | version:
|
7 |
| - description: "Release version (e.g., 1.2.3)" |
| 7 | + description: "Release version" |
8 | 8 | required: true
|
9 | 9 | type: string
|
10 | 10 | authors:
|
11 |
| - description: "Comma-separated list of the release authors' emails (e.g. [email protected],[email protected])" |
| 11 | + description: "Comma-separated list of author emails" |
12 | 12 | required: true
|
13 | 13 | type: string
|
14 |
| - commit_sha: |
15 |
| - description: "Commit SHA to use for the image (e.g. 7c2a91 or latest)" |
| 14 | + image_sha: |
| 15 | + description: "6-digit commit SHA used for the promoted image (e.g. 3e79a3 or 'latest')" |
16 | 16 | required: false
|
17 | 17 | default: "latest"
|
18 | 18 | type: string
|
19 | 19 |
|
20 | 20 | permissions:
|
21 | 21 | contents: write
|
22 | 22 | pull-requests: write
|
23 |
| - |
| 23 | + |
24 | 24 | jobs:
|
| 25 | + |
| 26 | + # Note, the first step is necessary for getting the exact commit from the passed in image_sha |
| 27 | + # This is because, the release-image step should exactly check out that exact commit |
| 28 | + image2commit: |
| 29 | + name: Resolve Commit SHA from Image |
| 30 | + runs-on: ubuntu-latest |
| 31 | + outputs: |
| 32 | + commit_sha: ${{ steps.resolve.outputs.commit_sha }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Log in to Docker registry |
| 36 | + uses: docker/login-action@v3 |
| 37 | + with: |
| 38 | + registry: docker.io |
| 39 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 40 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 41 | + |
| 42 | + - name: Run image2commit |
| 43 | + id: resolve |
| 44 | + uses: ./.github/actions/image2commit |
| 45 | + with: |
| 46 | + register: docker.io |
| 47 | + repo: andrpac/mongodb-atlas-kubernetes-operator-prerelease |
| 48 | + image_sha: ${{ github.event.inputs.image_sha }} |
| 49 | + |
| 50 | + check-commit: |
| 51 | + name: Check resolved commit |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: image2commit |
| 54 | + steps: |
| 55 | + - name: Echo resolved commit |
| 56 | + run: | |
| 57 | + echo "Resolved commit: ${{ needs.image2commit.outputs.commit_sha }}" |
| 58 | +
|
| 59 | + prepare-environment: |
| 60 | + name: Set up Environment Variables |
| 61 | + runs-on: ubuntu-latest |
| 62 | + if: false |
| 63 | + environment: release |
| 64 | + |
| 65 | + outputs: |
| 66 | + # Inputs |
| 67 | + version: ${{ steps.setup.outputs.version }} |
| 68 | + authors: ${{ steps.setup.outputs.authors }} |
| 69 | + commit_sha: ${{ steps.setup.outputs.commit_sha }} |
| 70 | + |
| 71 | + # Release related |
| 72 | + release_commit: ${{ steps.setup.outputs.release_commit }} |
| 73 | + release_branch: ${{ steps.setup.outputs.release_branch }} |
| 74 | + |
| 75 | + # Tags |
| 76 | + promoted_tag: ${{ steps.setup.outputs.promoted_tag }} |
| 77 | + release_tag: ${{ steps.setup.outputs.release_tag }} |
| 78 | + certified_tag: ${{ steps.setup.outputs.certified_tag }} |
| 79 | + |
| 80 | + # Repos |
| 81 | + docker_prerelease_repo: ${{ steps.setup.outputs.docker_prerelease_repo }} |
| 82 | + docker_release_repo: ${{ steps.setup.outputs.docker_release_repo }} |
| 83 | + docker_signature_repo: ${{ steps.setup.outputs.docker_signature_repo }} |
| 84 | + quay_prerelease_repo: ${{ steps.setup.outputs.quay_prerelease_repo }} |
| 85 | + quay_release_repo: ${{ steps.setup.outputs.quay_release_repo }} |
| 86 | + |
| 87 | + # Image URLs |
| 88 | + docker_image_url: ${{ steps.setup.outputs.docker_image_url }} |
| 89 | + quay_image_url: ${{ steps.setup.outputs.quay_image_url }} |
| 90 | + quay_certified_image_url: ${{ steps.setup.outputs.quay_certified_image_url }} |
| 91 | + |
| 92 | + steps: |
| 93 | + - name: Log in to Docker registry |
| 94 | + uses: docker/login-action@v3 |
| 95 | + with: |
| 96 | + registry: docker.io |
| 97 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 98 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 99 | + |
| 100 | + - name: Resolve inputs |
| 101 | + id: inputs |
| 102 | + run: | |
| 103 | + echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT |
| 104 | + echo "authors=${{ github.event.inputs.authors }}" >> $GITHUB_OUTPUT |
| 105 | + echo "image_sha=${{ github.event.inputs.image_sha }}" >> $GITHUB_OUTPUT |
| 106 | +
|
| 107 | + - name: Resolve commit SHA from image |
| 108 | + id: image2commit |
| 109 | + uses: ./.github/actions/image2commit |
| 110 | + with: |
| 111 | + image_sha: ${{ steps.inputs.outputs.image_sha }} |
| 112 | + repo: docker.io/andrpac/mongodb-atlas-kubernetes-operator-prerelease |
| 113 | + |
| 114 | + - name: Set derived environment variables |
| 115 | + id: setup |
| 116 | + run: | |
| 117 | + version="${{ steps.inputs.outputs.version }}" |
| 118 | + authors="${{ steps.inputs.outputs.authors }}" |
| 119 | + sha="${{ steps.image2commit.outputs.commit_sha }}" |
| 120 | +
|
| 121 | + docker_prerelease_repo="docker.io/andrpac/mongodb-atlas-kubernetes-operator-prerelease" |
| 122 | + docker_release_repo="docker.io/andrpac/mongodb-atlas-kubernetes-operator" |
| 123 | + docker_signature_repo="docker.io/andrpac/signatures" |
| 124 | + quay_prerelease_repo="quay.io/andrpac/mongodb-atlas-kubernetes-operator-prerelease" |
| 125 | + quay_release_repo="quay.io/andrpac/mongodb-atlas-kubernetes-operator" |
| 126 | +
|
| 127 | + short_sha="${sha:0:6}" |
| 128 | + promoted_tag="promoted-${short_sha}" |
| 129 | +
|
| 130 | + release_tag="$version" |
| 131 | + certified_tag="certified-${version}" |
| 132 | + release_branch="new-release/${version}" |
| 133 | + docker_image_url="${docker_release_repo}:${release_tag}" |
| 134 | + quay_image_url="${quay_release_repo}:${release_tag}" |
| 135 | + quay_certified_image_url="${quay_release_repo}:${certified_tag}" |
| 136 | +
|
| 137 | + echo "version=$version" >> $GITHUB_OUTPUT |
| 138 | + echo "authors=$authors" >> $GITHUB_OUTPUT |
| 139 | + echo "commit_sha=${{ steps.inputs.outputs.image_sha }}" >> $GITHUB_OUTPUT |
| 140 | + echo "release_commit=$sha" >> $GITHUB_OUTPUT |
| 141 | + echo "release_branch=$release_branch" >> $GITHUB_OUTPUT |
| 142 | + echo "promoted_tag=$promoted_tag" >> $GITHUB_OUTPUT |
| 143 | + echo "release_tag=$release_tag" >> $GITHUB_OUTPUT |
| 144 | + echo "certified_tag=$certified_tag" >> $GITHUB_OUTPUT |
| 145 | + echo "docker_prerelease_repo=$docker_prerelease_repo" >> $GITHUB_OUTPUT |
| 146 | + echo "docker_release_repo=$docker_release_repo" >> $GITHUB_OUTPUT |
| 147 | + echo "docker_signature_repo=$docker_signature_repo" >> $GITHUB_OUTPUT |
| 148 | + echo "quay_prerelease_repo=$quay_prerelease_repo" >> $GITHUB_OUTPUT |
| 149 | + echo "quay_release_repo=$quay_release_repo" >> $GITHUB_OUTPUT |
| 150 | + echo "docker_image_url=$docker_image_url" >> $GITHUB_OUTPUT |
| 151 | + echo "quay_image_url=$quay_image_url" >> $GITHUB_OUTPUT |
| 152 | + echo "quay_certified_image_url=$quay_certified_image_url" >> $GITHUB_OUTPUT |
| 153 | +
|
25 | 154 | release-image:
|
26 | 155 | runs-on: ubuntu-latest
|
| 156 | + if: false |
27 | 157 | environment: release
|
28 | 158 | env:
|
29 | 159 | VERSION: ${{ github.event.inputs.version }}
|
|
0 commit comments