chore(bors): merge pull request #1103 #194
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: Image Push | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - 'release/**' | |
| workflow_call: | |
| inputs: | |
| tag: | |
| description: 'Tag to be released (e.g. v2.10.0)' | |
| required: true | |
| type: string | |
| registry: | |
| description: 'Registry, example: ghcr.io' | |
| required: true | |
| type: string | |
| namespace: | |
| description: 'Namespace, example: mayastor/dev' | |
| required: true | |
| type: string | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CI: 1 | |
| TAG: ${{ inputs.tag }} | |
| jobs: | |
| image-build-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| fetch-depth: 0 | |
| - run: | | |
| # BUG: HEAD tag is fetched as lightweight instead of annotated | |
| # https://github.com/actions/checkout/issues/290 | |
| if [ "${{ github.ref_type }}" == "tag" ]; then | |
| git fetch -f origin ${{ github.ref }}:${{ github.ref }} | |
| fi | |
| - uses: cachix/install-nix-action@v31.3.0 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push the release images | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| ./scripts/release.sh --tag ${{ inputs.tag }} --registry ${{ inputs.registry }}/${{ github.repository_owner }}/${{ inputs.namespace }} | |
| elif [[ "${{ github.event_name }}" == "push" ]]; then | |
| ./scripts/release.sh | |
| fi |