chore(deps): update actions/checkout action to v4.1.7 (.github/workfl… #191
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: jenkins.2.228 | |
# This workflow is triggered on pushes to the repository. | |
on: | |
push: | |
paths: | |
- jenkins/2.228/* | |
- .github/workflows/jenkins-2.228.yaml | |
env: | |
WORKSPACE: jenkins/2.228 | |
DOCKER_REPO: cloudkats | |
DOCKER_IMAGE: jenkins | |
PURPOSE: cicd | |
jobs: | |
buildonpush: | |
name: BuildOnPush | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/[email protected] | |
- name: Build the Docker image | |
working-directory: ${{ env.WORKSPACE }} | |
run: | | |
echo "Build" | |
docker build . --file Dockerfile --tag image \ | |
--build-arg VERSION=$(cat version) | |
- name: Login to Registry | |
run: | | |
echo "${DOCKER_PASSWORD}" | docker login -u ${DOCKER_USERNAME} --password-stdin | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Docker image | |
working-directory: ${{ env.WORKSPACE }} | |
run: | | |
echo "Push" | |
image_version=$(cat version) | |
IMAGE_ID="${DOCKER_REPO}/${DOCKER_IMAGE}" | |
tag_date="$(date +%Y%d%m)" | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "master" ] && VERSION=latest | |
docker tag image "${IMAGE_ID}:${VERSION}" | |
docker push "${IMAGE_ID}:${VERSION}" | |
docker tag image "${IMAGE_ID}:${image_version}" | |
docker push "${IMAGE_ID}:${image_version}" | |
docker tag image "${IMAGE_ID}:${image_version}.${tag_date}" | |
docker push "${IMAGE_ID}:${image_version}.${tag_date}" |