modify to actions/checkout@v3 #134
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: Build image to DockerHub | ||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "apps/*/Dockerfile" | ||
- "apps/*/cmd.sh" | ||
- "apps/*/entrypoint.sh" | ||
jobs: | ||
test: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- name: Get applist | ||
id: getlist | ||
run: | | ||
git diff --name-only HEAD^ HEAD | ||
changed_files=$(git diff --name-only HEAD^ HEAD) | ||
app_list=$(echo "$changed_files" | grep -E 'apps/.*/(Dockerfile|cmd.sh|entrypoint.sh)$' | awk -F'/' '{print $2}' | sort | uniq) | ||
echo "APP_LISTS=$app_list" >> $GITHUB_ENV | ||
- uses: mr-smithers-excellent/docker-build-push@v5 | ||
name: Build & push Docker image | ||
if: env.PASS_STEP=='false' | ||
with: | ||
image: websoft9dev/${{env.W9_NAME}} | ||
tags: ${{env.TAGS}} | ||
registry: docker.io | ||
dockerfile: Dockerfile | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Docker Hub Description | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: websoft9dev/${{env.W9_NAME}} | ||
readme-filepath: apps/${{env.W9_NAME}}/myread.md |