This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
Version Packages (#441) #235
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
# Copyright 2023 Hazmi35 (https://github.com/Hazmi35) | |
name: Services Nightly Builds | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "Dockerfile" | |
- "services/**" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "Dockerfile" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
folders: ${{ steps.json.outputs.folders }} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
fetch-depth: 2 | |
- name: List changed folders | |
id: changed | |
run: | | |
echo ::set-output name=folders::$(git diff --name-only HEAD~1 HEAD | grep -E 'services/.*' | cut -d'/' -f2 | sort | uniq | tr '\n' ',' | sed 's/,$//') | |
- name: List all folders if no changes | |
if: steps.changed.outputs.folders == '' | |
id: all | |
run: | | |
echo ::set-output name=folders::$(ls services | tr '\n' ',' | sed 's/,$//') | |
- name: Turn output into JSON array | |
id: json | |
run: | | |
echo ::set-output name=folders::[$(echo ${{ steps.changed.outputs.folders || steps.all.outputs.folders }} | sed 's/,/","/g;s/^/"/;s/$/"/')] | |
docker: | |
needs: build | |
uses: ./.github/workflows/docker.yml | |
with: | |
scope: ${{ needs.build.outputs.folders }} | |
secrets: inherit |