[build][update] enhance image build and push steps in CI workflow #24
Workflow file for this run
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: Build image on MAIN branch | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| package-image: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production # Set the environment name | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get previous tag | |
| id: previoustag | |
| uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
| with: | |
| fallback: 1.0.0 # Optional fallback tag to use when no tag can be found | |
| #workingDirectory: another/path/where/a/git/repo/is/checked/out # Optional alternative working directory | |
| - name: Build vngcloud-blockstorage-csi-driver image | |
| env: | |
| NEW_VERSION: ${{ steps.previoustag.outputs.tag }} | |
| run: | | |
| export REGISTRY=${{ vars.VCR_REGISTRY }} | |
| export VERSION=${{ github.ref_name }} | |
| make build-local-images | |
| - name: Login to VngCloud Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ vars.VCR_REGISTRY }} | |
| username: ${{ secrets.VCR_USERNAME }} | |
| password: ${{ secrets.VCR_PASSWORD }} | |
| - name: Push vngcloud-blockstorage-csi-driver image to vcr registry | |
| env: | |
| NEW_VERSION: ${{ steps.previoustag.outputs.tag }} | |
| run: | | |
| export REGISTRY=${{ vars.VCR_REGISTRY }} | |
| export VERSION=${{ github.ref_name }} | |
| make bush-local-images | |
| - name: Login to VngCloud Registry HAN | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ vars.VCR_HAN_REGISTRY }} | |
| username: ${{ secrets.VCR_HAN_USERNAME }} | |
| password: ${{ secrets.VCR_HAN_PASSWORD }} | |
| - name: Push vngcloud-blockstorage-csi-driver image to vcr registry | |
| env: | |
| NEW_VERSION: ${{ steps.previoustag.outputs.tag }} | |
| run: | | |
| export REGISTRY=${{ vars.VCR_HAN_REGISTRY }} | |
| export VERSION=${{ github.ref_name }} | |
| make bush-local-images |