Skip to content

Commit

Permalink
modify to actions/checkout@v3
Browse files Browse the repository at this point in the history
  • Loading branch information
chendelin1982 authored Dec 6, 2023
1 parent 1707161 commit b479c47
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

Expand All @@ -27,7 +27,7 @@ jobs:
echo "APP_LISTS=$(git diff --name-only HEAD^ HEAD -- 'apps/*/variables.json' | awk -F/ '{print $2}' | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
echo "APP_LISTS_ALL=$(ls -d apps/*/ | cut -f2 -d'/' | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
git diff --name-only HEAD^ HEAD | grep 'template/README.jinja2' && echo "TPL_README=changed" >> $GITHUB_ENV || true
git diff --name-only HEAD^ HEAD | grep 'template/ariables.json' && echo "TPL_VARS=changed" >> $GITHUB_ENV || true
git diff --name-only HEAD^ HEAD | grep 'template/variables.json' && echo "TPL_VARS=changed" >> $GITHUB_ENV || true
- name: Update readme when app's variables.json changed
run: python3 build/update_readme.py "${{ env.APP_LISTS }}"
Expand Down
83 changes: 13 additions & 70 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,23 @@ on:
- "apps/*/entrypoint.sh"

jobs:
build:
test:
name: Build Docker image
runs-on: ubuntu-latest
env:
TAGS: latest
steps:
- uses: actions/checkout@v2
name: Check out code

- name: set appname
run: |
changefile=$(curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{github.token}}" \
https://api.github.com/repos/Websoft9/docker-library/compare/${{github.event.before}}...${{github.event.after}} | jq '.files[].filename' | sed 's/\"//g')
first="true"
pass="false"
for name in ${changefile};do
echo ${name}
app=$(echo ${name} | cut -d "/" -f 2)
file=$(echo ${name} | cut -d "/" -f 3)
if [[ ${file} == "Dockerfile" ]] || [[ ${file} == "cmd.sh" ]] || [[ ${file} == "entrypoint.sh" ]];then
if [ ${first} == "true" ];then
echo "set appname";
appname=${app};
first="false";
else
echo "compare name";
if [ ${appname} != ${app} ];then
echo "stop update image on github";
pass="true"
fi
fi
else
echo "affect nothing";
fi
done
echo ${appname}
echo "W9_NAME=${appname}" >> $GITHUB_ENV
echo "PASS_STEP=${pass}" >> $GITHUB_ENV
cp -r apps/${appname}/* .
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: set tags
if: env.PASS_STEP=='false'
run: |
tag=$(cat apps/${{env.W9_NAME}}/variables.json | jq '.version' | sed 's/\"//g')
echo ${tag}
if [ ${tag} != "null" ];then
echo "set tags"
arraytag1=$(echo ${tag} | cut -d "." -f 1)
arraytag2=$(echo ${tag} | cut -d "." -f 2)
arraytag3=$(echo ${tag} | cut -d "." -f 3)
echo "$arraytag1 $arraytag2"
if [ ${arraytag3}x != x ];then
TAGS=${arraytag1},${arraytag1}.${arraytag2},${tag},latest
else
TAGS=${arraytag1},${tag},latest
fi
else
TAGS="latest"
fi
echo "123$TAGS"
echo "TAGS=${TAGS}" >> $GITHUB_ENV
- 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
Expand All @@ -84,17 +38,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: add readme file
run: |
cd apps/${{env.W9_NAME}}
touch myread.md
echo "This repository is the easiest ${{env.W9_NAME}} deployment on GitHub and DockerHub "'
```
git clone https://github.com/Websoft9/docker-library.git
cd docker-library/apps/${{env.W9_NAME}}
sudo docker network create websoft9 && sudo docker compose up -d
```' > myread.md
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
repository: ['Websoft9/plugin-appstore', 'Websoft9/plugin-myapps']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ matrix.repository }}
ref: main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
CI: false
appname: library
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
name: Check out code

- name: Version convert
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_contentful.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

Expand Down

0 comments on commit b479c47

Please sign in to comment.