replace deprecated set-output with env file #75
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: Build Images | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
changes: | |
name: image list | |
runs-on: ubuntu-22.04 | |
outputs: | |
changed: ${{ steps.filter.outputs.changed }} | |
matrix: ${{ steps.images.outputs.matrix }} | |
steps: | |
- id: checkout | |
uses: actions/checkout@v4 | |
- id: filter | |
uses: dorny/paths-filter@v3 | |
with: | |
base: ${{ github.ref }} | |
list-files: shell | |
filters: | | |
changed: | |
added|modified: 'rails/**' | |
- id: images | |
if: steps.filter.outputs.changed == 'true' | |
run: | | |
VERS=() | |
PATHS=(${{ steps.filter.outputs.changed_files }}) | |
for p in "${PATHS[@]}" ; do | |
IFS='/' read -r -a parts <<< "$p" | |
IMAGES+=("${parts[1]}") | |
done | |
MATRIX=$(echo "${IMAGES[@]}" | tr ' ' '\n' | sort -u | jq -R | jq -sc '{context: .}') | |
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT | |
docker-images: | |
runs-on: ubuntu-22.04 | |
needs: changes | |
if: ${{ needs.changes.outputs.changed == 'true' }} | |
strategy: | |
matrix: ${{ fromJson(needs.changes.outputs.matrix) }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: setup docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: login ghcr | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: base image | |
uses: docker/build-push-action@v5 | |
with: | |
context: rails/${{ matrix.context }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/rails:${{ matrix.context }} | |
- name: Development Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: rails/${{ matrix.context }}/dev | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/rails:${{ matrix.context }}-dev |