add debugging statements #9
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: main | |
on: | |
push: | |
tags-ignore: "ignore" | |
branches: main | |
# Run tests for any PRs. | |
pull_request: | |
jobs: | |
build_container: | |
env: | |
IMAGE_NAME: "k8s-swap-cgroup" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
cd container | |
docker build . --build-arg arg_k8s_application_commit=${{ github.sha }} --build-arg arg_k8s_application_version=${{ github.ref }} --tag $IMAGE_NAME | |
cd .. | |
- name: Log into registry | |
run: echo "${{ secrets.dockerhub_token }}" | docker login -u x4bnet --password-stdin | |
- name: Push image | |
shell: bash | |
run: | | |
IMAGE_ID=x4bnet/$IMAGE_NAME | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
if [[ "$VERSION" == "latest" ]]; then | |
docker tag $IMAGE_NAME $IMAGE_ID:git-${{ github.sha }} | |
docker push $IMAGE_ID:git-${{ github.sha }} | |
fi |