Skip to content

Update Dev.yml

Update Dev.yml #10

Workflow file for this run

name: TFB Dev env
on:
push:
branches:
- main
paths:
- .github/workflows/Dev.yml
- .devcontainer/Dockerfile
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
# Login to Harbor
- name: Login to Nexus Docker Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.HARBOR_DOCKER_REGISTRY }}
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
# Build and push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile
push: true
tags: ${{ secrets.HARBOR_DOCKER_REGISTRY }}/tfb-dev:latest
build-args: |
MAVEN_URL=${{ secrets.MAVEN_URL }}
MAVEN_USERNAME=${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD=${{ secrets.MAVEN_PASSWORD }}
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 }}