123 #29
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: Docker | |
on: | |
push: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v44 | |
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g | |
with: | |
# since_last_remote_commit: true | |
# files: ** | |
files_ignore: .github/** | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
USERNAME: ${{secrets.USERNAME}} | |
PASSWORD: ${{secrets.PASSWORD}} | |
run: | | |
docker login -u ${USERNAME} -p ${PASSWORD} | |
for file in ${ALL_CHANGED_FILES}; do | |
CHANGEFOLDER=$(echo ${file}|awk -F"/" '{print $1}') | |
cd ${CHANGEFOLDER} | |
VERSION=$(grep -w VERSION Dockerfile |awk -F":" '{print $2}') | |
echo ${VERSION} | |
IMAGENAME=$(echo pilgrima/${CHANGEFOLDER}:${VERSION}) | |
echo ${IMAGENAME} | |
docker buildx build -t ${IMAGENAME} . | |
docker push ${IMAGENAME} | |
docker tag ${IMAGENAME} $(echo pilgrima/${CHANGEFOLDER}:latest) | |
docker push $(echo pilgrima/${CHANGEFOLDER}:latest) | |
done | |