moved k8s files #108
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: Creative | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'creative/**' | |
- .github/workflows/Creative.yml | |
jobs: | |
build-test-publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Set up Docker | |
- name: Set up Docker Build | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Execute Gradle build | |
env: | |
MAVEN_URL: ${{ secrets.MAVEN_URL }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
run: cd creative && gradle update --no-build-cache | |
# Login to Nexus Artifactory | |
- name: Login to Nexus Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.DOCKER_REPO }} # change this to your Nexus Registry URL | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# Build and push Docker image | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./creative # specifying the directory where your Dockerfile is | |
file: ./creative/Dockerfile # specifying the path to your Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_REPO }}/creative:latest # change this to your image name | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Cleanup | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" | |
echo "Fetching list of cache key" | |
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
echo "Deleting caches..." | |
for cacheKey in $cacheKeysForPR | |
do | |
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | |
done | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |