Skip to content

Use pinned by hash versions for github actions (#419) #239

Use pinned by hash versions for github actions (#419)

Use pinned by hash versions for github actions (#419) #239

Workflow file for this run

name: Schema File Tools Docker Image
on:
push:
tags: [ '**' ]
branches: [ main ]
pull_request:
branches: [ main ]
paths:
- .github/workflows/schema_tools.yml
- schemas/*
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Build the Docker image
run: docker build schemas/. -t build-tool-schemas
- name: Login to GitHub Package Registry
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
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 build-tool-schemas "otel/build-tool-schemas:${1}" && docker push "otel/build-tool-schemas:${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