Fix referencing template attributes (#206) #129
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: C++ Format Tools Docker Image | |
on: | |
push: | |
tags: [ '**' ] | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
paths: | |
- .github/workflows/cpp_format_tools.yml | |
- cpp_format_tools/* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: docker build cpp_format_tools/. -t cpp_format_tools | |
- name: Login to GitHub Package Registry | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push the Docker image | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
run: | | |
function tag_and_push { | |
docker tag cpp_format_tools "otel/cpp_format_tools:${1}" && docker push "otel/cpp_format_tools:${1}" | |
} | |
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then | |
tag_and_push "latest" | |
elif [[ "${GITHUB_REF}" =~ refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
TAG="${GITHUB_REF#"refs/tags/v"}" | |
tag_and_push "${TAG}" | |
else | |
tag_and_push "${GITHUB_REF#"refs/tags/"}" | |
fi |