-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set env vars correctly in workflow steps
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
- Loading branch information
1 parent
10f3fb2
commit 71ed0f2
Showing
2 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: "Remove me before merging" | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
publish-containers: | ||
name: Publish container images | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set env vars for the job | ||
run: | | ||
grep -v '\#' versions.txt | grep opentelemetry-collector | awk -F= '{print "OTELCOL_VERSION="$2}' >> $GITHUB_ENV | ||
echo "VERSION_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | ||
echo "VERSION=$(git describe --tags | sed 's/^v//')" >> $GITHUB_ENV | ||
- name: Docker meta | ||
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: quay.io/opentelemetry/opentelemetry-operator | ||
tag-semver: | | ||
{{raw}} | ||
{{version}} | ||
{{major}}.{{minor}} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to Quay | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Build and push Operator image | ||
uses: docker/build-push-action@v2 | ||
env: | ||
VERSION_PKG: github.com/open-telemetry/opentelemetry-operator/internal/version | ||
VERSION: ${{ env.VERSION }} | ||
VERSION_DATE: ${{ env.VERSION_DATE }} | ||
OTELCOL_VERSION: ${{ env.OTELCOL_VERSION }} | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
labels: ${{ steps.docker_meta.outputs.labels }} | ||
build-args: | | ||
VERSION_PKG=${VERSION_PKG} | ||
VERSION=${VERSION} | ||
VERSION_DATE=${VERSION_DATE} | ||
OTELCOL_VERSION=${OTELCOL_VERSION} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache |