Add workflows for the chart to CI #34
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 and publish tags to ghcr.io | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| env: | |
| WERF_STAGED_DOCKERFILE_VERSION: v2 | |
| jobs: | |
| build: | |
| name: build images for tag | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get the version | |
| id: get_version | |
| run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
| - uses: werf/actions/install@v1.2 | |
| - name: Login into ghcr.io | |
| shell: bash | |
| run: werf cr login -u ${{ github.actor }} -p ${{ github.token }} ghcr.io/${{ github.repository }} | |
| # Extract metadata (tags, labels) for Docker | |
| # https://github.com/docker/metadata-action | |
| - name: Extract Docker metadata | |
| uses: docker/metadata-action@v5.6.1 | |
| with: | |
| images: ghcr.io/${{ github.repository }}/${{ matrix.name }} | |
| # Build and push Docker image with Buildx (don't push on PR) | |
| # https://github.com/docker/build-push-action | |
| - name: Build Image | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| source "$(werf ci-env github --as-file)" | |
| . "$(jq -r '.labels | to_entries | to_entries[] | "WERF_EXPORT_ADD_LABEL_\(.key)=\(.value.key)=\(.value.value)"' <<< $DOCKER_METADATA_OUTPUT_JSON)" | |
| werf build | |
| # with: | |
| # push: ${{ github.event_name == 'pull_request' }} | |
| # tags: ${{ steps.meta.outputs.tags }} | |
| # labels: ${{ steps.meta.outputs.labels }} | |
| # build-args: | | |
| # TAG=${{ github.ref_name }} | |
| # platforms: linux/amd64,linux/arm64,linux/arm | |
| # file: ./Dockerfile.${{ matrix.name }} |