pipe function for watcher.rs and replaced usage #1716
This file contains 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 upload Docker image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io/${{ github.repository_owner }} | |
jobs: | |
release-please: | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
outputs: | |
indexer-service-rs: ${{ steps.release-please.outputs.service--tag_name }} | |
indexer-tap-agent: ${{ steps.release-please.outputs.tap-agent--tag_name }} | |
steps: | |
- name: Release please | |
id: release-please | |
uses: googleapis/release-please-action@v4 | |
builds-linux: | |
runs-on: ubuntu-latest | |
needs: release-please | |
strategy: | |
matrix: | |
target: [indexer-service-rs, indexer-tap-agent] | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Extract version from tag | |
id: extract_version | |
run: | | |
TAG_NAME="${{ needs.release-please.outputs[matrix.target] }}" | |
# Extract the version part from tags with prefix "${{ matrix.target }}-" using a regex pattern | |
if [[ "$TAG_NAME" =~ ^${{ matrix.target }}-(.*)$ ]]; then | |
VERSION="${BASH_REMATCH[1]}" | |
else | |
VERSION="" | |
fi | |
echo $VERSION | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
${{ env.REGISTRY }}/${{matrix.target}} | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern={{major}}.{{minor}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern={{major}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern=v{{version}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern=v{{major}}.{{minor}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},value=${{steps.extract_version.outputs.version}} | |
type=semver,pattern=v{{major}},value=${{steps.extract_version.outputs.version}} | |
type=sha | |
- name: Log in to the Container registry | |
uses: docker/login-action@06895751d15a223ec091bea144ad5c7f50d228d0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6 | |
with: | |
context: ./ | |
push: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} | |
tags: ${{ steps.meta.outputs.tags }} | |
file: Dockerfile.${{ matrix.target }} |