Build Docker #44
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 Docker | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: | |
| - Up version | |
| types: | |
| - completed | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository_owner }}/datalens-docs | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| run: | |
| name: build-docker | |
| runs-on: ubuntu-latest | |
| if: ${{ github.actor == 'robot-charts' || github.event_name == 'workflow_dispatch' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: get latest tag | |
| id: tag | |
| run: | | |
| git fetch --tags | |
| TAG=$(git tag -l "v*" | sort -V | tail -n 1) | |
| VERSION=$(echo "${TAG}" | sed 's|^v||') | |
| echo "tag: ${TAG}" | |
| echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
| echo "version: ${VERSION}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: checkout latest tag | |
| run: git checkout ${{ steps.tag.outputs.tag }} | |
| - uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: 'arm64' | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/[email protected] | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: meta | |
| uses: docker/[email protected] | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=${{ steps.tag.outputs.version }} | |
| type=raw,value=latest | |
| - uses: docker/[email protected] | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |