publish-collector-agent #13
Workflow file for this run
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: publish-collector-agent | |
on: | |
workflow_dispatch: | |
inputs: | |
push: | |
description: Do you want to push to ghcr.io | |
required: true | |
default: false | |
type: boolean | |
jobs: | |
collector-agent: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'true' | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build the collector-agent Docker image | |
run: | | |
IMAGE_NAME=collector-agent | |
IMAGE_TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && IMAGE_TAG=$(echo $IMAGE_TAG | sed -e 's/^v//') | |
IMAGE_ID=ghcr.io/$GITHUB_REPOSITORY | |
# docker build --pull --no-cache . --file collector-agent/Dockerfile --tag $IMAGE_NAME | |
cd collector-agent && make docker TAG=$IMAGE_NAME | |
docker tag $IMAGE_NAME $IMAGE_ID/$IMAGE_NAME:$IMAGE_TAG | |
docker tag $IMAGE_NAME $IMAGE_ID/$IMAGE_NAME:latest | |
if [[ ${{ inputs.push }} == "true" ]]; then | |
echo ${{ inputs.push }} | |
docker push --all-tags $IMAGE_ID/$IMAGE_NAME | |
fi |