BuildNightlyContainerImage #164
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: BuildNightlyContainerImage | |
on: | |
schedule: | |
# This is a UTC time | |
- cron: "0 0 * * *" | |
# Keep it only for test purpose, comment it once everything is ok | |
workflow_dispatch: | |
env: | |
# TODO: Change variable to your image's repo. | |
IMAGE_REPO: ${{ vars.IMAGE_REPO }} | |
IMAGE_VERSION: latest | |
jobs: | |
build: | |
name: Build | |
runs-on: self-hosted | |
# TODO: Change variable to your repo's name. | |
if: github.repository == 'edgewize-io/vcluster' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Log into registry | |
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ vars.DOCKER_USERNAME }} --password-stdin ${{ vars.IMAGE_REPO }} | |
- name: Declare some variables | |
shell: bash | |
run: | | |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV" | |
#echo "suffix=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
echo "suffix=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV" | |
- name: Build and push docker images | |
run: | | |
REPO=$IMAGE_REPO TAG="${{ env.branch }}-${{ env.suffix }}" make container-push |