Merge pull request #674 from shiftstack/ensure-deps-available #508
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: container image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| env: | |
| image_tag_branch: quay.io/orc/openstack-resource-controller:branch-${GITHUB_REF_NAME} | |
| image_tag_commit: quay.io/orc/openstack-resource-controller:commit-${GITHUB_SHA::7} | |
| jobs: | |
| push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2 | |
| with: | |
| # Required for git describe to generate correct output for populating | |
| # build variables | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| persist-credentials: false | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # tag=v4.0.0 | |
| - name: Build and push images | |
| run: | | |
| docker login -u="${{ secrets.QUAY_USERNAME }}" -p="${{ secrets.QUAY_TOKEN }}" quay.io # zizmor: ignore[secrets-outside-env] | |
| # Ensure we source identical build arguments for both builds | |
| source hack/version.sh && version::get_git_vars && version::get_build_date && \ | |
| make docker-buildx IMG=${{ env.image_tag_branch }} && \ | |
| make docker-buildx IMG=${{ env.image_tag_commit }} | |
| - name: Set expiration on commit image | |
| env: | |
| QUAY_OAUTH_TOKEN: ${{ secrets.QUAY_OAUTH_TOKEN }} # zizmor: ignore[secrets-outside-env] | |
| run: | | |
| EXPIRATION=$(($(date -u +%s) + 2419200)) | |
| curl -sf -X PUT \ | |
| -H "Authorization: Bearer ${QUAY_OAUTH_TOKEN}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"expiration\": $EXPIRATION}" \ | |
| "https://quay.io/api/v1/repository/orc/openstack-resource-controller/tag/commit-${GITHUB_SHA::7}" |