-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
it is now a reusable workflow that can be included into other workflows. two were added: one workflow for PRs, and a second for protected branches / tags Signed-off-by: Bryant Finney <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Summary: define a CI/CD pipelines to run on PRs | ||
name: ⬅️ PR Checks | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/docker-build.yml | ||
- Dockerfile | ||
- docker-compose.yml | ||
- platforms.yml | ||
- poetry.lock | ||
|
||
jobs: | ||
changes: | ||
# identify types of files that have changed in this PR | ||
|
||
name: 🔎 Check for changes | ||
env: | ||
# these types of files should all impact image builds | ||
DOCKER_FILES: |- | ||
.github/workflows/docker-build.yml | ||
Dockerfile | ||
docker-compose.yml | ||
platforms.yml | ||
poetry.lock | ||
TYPES_DIR: /tmp/types | ||
|
||
outputs: | ||
docker: ${{ steps.compare.outputs.docker }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📂 Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 📐 Setup | ||
run: | | ||
mkdir -p $TYPES_DIR | ||
printf "%s\n" "${{ env.DOCKER_FILES }}" | sort >$TYPES_DIR/docker-files.txt | ||
- name: 📝 List changes | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: gh pr diff --name-only ${{ github.event.number }} | sort >/tmp/changes.txt | ||
|
||
- name: ❔ Compare | ||
id: compare | ||
run: | | ||
for type_path in $TYPES_DIR/*.txt; do | ||
type_name="$(basename "$type_path" | rev | cut -d- -f2- | rev)" | ||
comm -12 $type_path /tmp/changes.txt | xargs -I{} test -z "{}" || | ||
echo "${type_name}=true" >>"$GITHUB_OUTPUT" | ||
done | ||
call-docker-build: | ||
if: needs.changes.outputs.docker == 'true' | ||
needs: changes | ||
|
||
permissions: | ||
packages: write | ||
|
||
uses: ./.github/workflows/docker-build.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Summary: define a CI/CD pipeline to run on protected refs | ||
on: | ||
push: | ||
tags: v* | ||
branches: | ||
- main | ||
|
||
jobs: | ||
call-docker-build: | ||
permissions: | ||
packages: write | ||
|
||
uses: ./.github/workflows/docker-build.yml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.