-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-image: | ||
strategy: | ||
matrix: | ||
apps: | ||
- name: job_sidecar_container | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
- name: Get changed files in the docs folder | ||
id: changed-files-specific | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: services/${{ matrix.apps.name }}/** | ||
- name: Set up QEMU | ||
if: steps.changed-files-specific.outputs.any_changed == 'true' | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
if: steps.changed-files-specific.outputs.any_changed == 'true' | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Package Registry | ||
if: steps.changed-files-specific.outputs.any_changed == 'true' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set Github tag | ||
if: steps.changed-files-specific.outputs.any_changed == 'true' | ||
id: vars | ||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
- name: Build and push | ||
if: steps.changed-files-specific.outputs.any_changed == 'true' | ||
uses: docker/build-push-action@v5 | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
with: | ||
context: services/${{ matrix.apps.name }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: github.ref == 'refs/heads/main' | ||
tags: | | ||
ghcr.io/porter-dev/${{ matrix.apps.name }}:${{ steps.vars.outputs.sha_short }} | ||
ghcr.io/porter-dev/${{ matrix.apps.name }}:latest |
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