Update API version on exec config #4
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: docker-hub-push | |
on: | |
push: | |
branches: | |
- 'main' | |
env: | |
IMAGE_NAME: ghcr.io/4armed/kubeletmein | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create image tag | |
id: vars | |
run: | | |
BRANCH_NAME=${GITHUB_REF##*/} | |
COMMIT_SHA=$(git rev-parse --short HEAD) | |
TIMESTAMP=$(date +%s) | |
TAG="${BRANCH_NAME}-${COMMIT_SHA}-${TIMESTAMP}" | |
echo ::set-output name=tag::$TAG | |
- name: Build with Docker | |
run: docker build . -f build/Dockerfile --tag ${{ env.IMAGE_NAME }}:${{steps.vars.outputs.tag}} --label "org.opencontainers.image.source=${{github.server_url}}/${{github.repository}}" | |
- name: Push the tagged Docker image | |
run: docker push ${{ env.IMAGE_NAME }}:${{steps.vars.outputs.tag}} | |
- name: Tag image as latest | |
run: docker tag ${{ env.IMAGE_NAME }}:${{steps.vars.outputs.tag}} ${{ env.IMAGE_NAME }}:latest | |
- name: Push latest | |
run: docker push ${{ env.IMAGE_NAME }}:latest | |
- name: Clear config | |
if: always() | |
run: | | |
rm -f ${HOME}/.docker/config.json |