|
| 1 | +# workflow to release assets as part of the release |
| 2 | + |
1 | 3 | on:
|
2 | 4 | push:
|
3 | 5 | tags:
|
|
6 | 8 | name: Upload Release Asset
|
7 | 9 |
|
8 | 10 | jobs:
|
9 |
| - build: |
| 11 | + readiness: |
| 12 | + name: check for appropriate image |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Set version and imagename |
| 16 | + id: get_version |
| 17 | + run: | |
| 18 | + echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//} |
| 19 | + echo ::set-env name=IMAGENAME::packethost/cluster-api-provider-packet |
| 20 | + echo ::set-env name=COMMIT::${GITHUB_SHA} |
| 21 | + - name: information |
| 22 | + run: echo "checking for existence of image ${IMAGENAME}:${COMMIT}. If it does not exist, this will fail; wait for an earlier PR merge action to complete and re-run this job." |
| 23 | + - name: docker login |
| 24 | + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin |
| 25 | + - name: check for docker image on hub |
| 26 | + run: docker buildx imagetools inspect ${IMAGENAME}:${COMMIT} |
| 27 | + - name: report |
| 28 | + run: ready for release; the docker image ${IMAGENAME}:${COMMIT} is available |
| 29 | + |
| 30 | + release: |
10 | 31 | name: Upload Release Asset
|
| 32 | + needs: |
| 33 | + - readiness |
11 | 34 | runs-on: ubuntu-latest
|
12 | 35 | steps:
|
13 | 36 | - name: Checkout code
|
|
74 | 97 | asset_path: out/release/infrastructure-packet/${{ env.VERSION }}/metadata.yaml
|
75 | 98 | asset_name: metadata.yaml
|
76 | 99 | asset_content_type: application/yaml
|
| 100 | + |
| 101 | + images: |
| 102 | + runs-on: ubuntu-latest |
| 103 | + needs: |
| 104 | + - readiness |
| 105 | + steps: |
| 106 | + - name: docker login |
| 107 | + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin |
| 108 | + - name: Set version and imagename |
| 109 | + id: get_version |
| 110 | + run: | |
| 111 | + echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//} |
| 112 | + echo ::set-env name=IMAGENAME::packethost/cluster-api-provider-packet |
| 113 | + echo ::set-env name=COMMIT::${GITHUB_SHA} |
| 114 | + - name: get-image |
| 115 | + run: docker image pull ${IMAGENAME}:${COMMIT} |
| 116 | + - name: release-latest |
| 117 | + run: | |
| 118 | + docker tag ${IMAGENAME}:${COMMIT} ${IMAGENAME}:latest |
| 119 | + docker push ${IMAGENAME}:latest |
| 120 | + - name: release-semver |
| 121 | + run: | |
| 122 | + docker tag ${IMAGENAME}:${COMMIT} ${IMAGENAME}:${VERSION} |
| 123 | + docker push ${IMAGENAME}:${VERSION} |
0 commit comments