forked from loft-sh/vcluster
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from MDZZ110/enhance/add-workflows
add build image workflow file
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: BuildContainerImage | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
# 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 | ||
|
||
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 |