repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

pico / .github / workflows
Eric Bower  ·  2025-08-19

build.yml

  1name: Test and Build
  2
  3on:
  4  workflow_dispatch:
  5  push:
  6    branches:
  7      - main
  8    tags:
  9      - v*
 10
 11env:
 12  REGISTRY: ghcr.io
 13  PLATFORMS: |
 14    linux/amd64
 15    linux/arm64    
 16
 17jobs:
 18  test:
 19    runs-on: ubuntu-22.04
 20    steps:
 21    - name: Checkout repo
 22      uses: actions/checkout@v3
 23    - name: Run tests and lint
 24      uses: ./.github/actions/test
 25  build-main:
 26    runs-on: ubuntu-22.04
 27    needs: test
 28    strategy:
 29      matrix:
 30        APP: [prose, pastes, pgs, feeds, pipe]
 31    steps:
 32    - name: Checkout repo
 33      uses: actions/checkout@v3
 34    - name: Setup docker
 35      uses: ./.github/actions/setup
 36      with:
 37        registry: ${{ env.REGISTRY }}
 38        username: ${{ github.actor }}
 39        password: ${{ secrets.GITHUB_TOKEN }}
 40    - name: Run docker build for ${{ matrix.APP }}
 41      uses: ./.github/actions/build
 42      with:
 43        app: ${{ matrix.APP }}
 44        platforms: ${{ env.PLATFORMS }}
 45        registry: ${{ env.REGISTRY }}
 46  build-auth:
 47    runs-on: ubuntu-22.04
 48    needs: test
 49    steps:
 50    - name: Checkout repo
 51      uses: actions/checkout@v3
 52    - name: Setup docker
 53      uses: ./.github/actions/setup
 54      with:
 55        registry: ${{ env.REGISTRY }}
 56        username: ${{ github.actor }}
 57        password: ${{ secrets.GITHUB_TOKEN }}
 58    - name: Run docker build for auth
 59      uses: ./.github/actions/build
 60      with:
 61        app: auth
 62        platforms: ${{ env.PLATFORMS }}
 63        registry: ${{ env.REGISTRY }}
 64        ssh: false
 65  build-pico:
 66    runs-on: ubuntu-22.04
 67    needs: test
 68    steps:
 69    - name: Checkout repo
 70      uses: actions/checkout@v3
 71    - name: Setup docker
 72      uses: ./.github/actions/setup
 73      with:
 74        registry: ${{ env.REGISTRY }}
 75        username: ${{ github.actor }}
 76        password: ${{ secrets.GITHUB_TOKEN }}
 77    - name: Run docker build for pico
 78      uses: ./.github/actions/build
 79      with:
 80        app: pico
 81        platforms: ${{ env.PLATFORMS }}
 82        registry: ${{ env.REGISTRY }}
 83        web: false
 84  build-pgs-cdn:
 85    runs-on: ubuntu-22.04
 86    needs: test
 87    steps:
 88    - name: Checkout repo
 89      uses: actions/checkout@v3
 90    - name: Setup docker
 91      uses: ./.github/actions/setup
 92      with:
 93        registry: ${{ env.REGISTRY }}
 94        username: ${{ github.actor }}
 95        password: ${{ secrets.GITHUB_TOKEN }}
 96    - name: Collect web image metadata
 97      id: pgscdnmeta
 98      uses: docker/metadata-action@v4
 99      with:
100        images: ${{ env.REGISTRY }}/${{ github.repository }}/pgs-cdn
101    - name: Build and push
102      uses: docker/build-push-action@v3
103      with:
104        context: .
105        file: Dockerfile.cdn
106        push: true
107        target: release-web
108        tags: ${{ steps.pgscdnmeta.outputs.tags }}
109        labels: ${{ steps.pgscdnmeta.outputs.labels }}
110        platforms: ${{ env.PLATFORMS }}
111        cache-from: type=gha
112        cache-to: type=gha,mode=max
113  build-pgs-standalone:
114    runs-on: ubuntu-22.04
115    needs: test
116    steps:
117    - name: Checkout repo
118      uses: actions/checkout@v3
119    - name: Setup docker
120      uses: ./.github/actions/setup
121      with:
122        registry: ${{ env.REGISTRY }}
123        username: ${{ github.actor }}
124        password: ${{ secrets.GITHUB_TOKEN }}
125    - name: Collect web image metadata
126      id: pgsstandalonemeta
127      uses: docker/metadata-action@v4
128      with:
129        images: ${{ env.REGISTRY }}/picosh/pgs
130    - name: Build and push
131      uses: docker/build-push-action@v3
132      with:
133        context: .
134        file: Dockerfile.standalone
135        push: true
136        target: release
137        tags: ${{ steps.pgsstandalonemeta.outputs.tags }}
138        labels: ${{ steps.pgsstandalonemeta.outputs.labels }}
139        platforms: ${{ env.PLATFORMS }}
140        cache-from: type=gha
141        cache-to: type=gha,mode=max
142  build-bouncer:
143    runs-on: ubuntu-22.04
144    needs: test
145    steps:
146    - name: Checkout repo
147      uses: actions/checkout@v3
148    - name: Get changed files
149      id: changed-files
150      uses: tj-actions/changed-files@v40
151      with:
152        files: bouncer/**
153    - name: Setup docker
154      if: steps.changed-files.outputs.any_changed == 'true'
155      uses: ./.github/actions/setup
156      with:
157        registry: ${{ env.REGISTRY }}
158        username: ${{ github.actor }}
159        password: ${{ secrets.GITHUB_TOKEN }}
160    - name: Collect bouncer image metadata
161      if: steps.changed-files.outputs.any_changed == 'true'
162      id: bouncermeta
163      uses: docker/metadata-action@v4
164      with:
165        images: ${{ env.REGISTRY }}/${{ github.repository }}/bouncer
166    - name: Build and push
167      if: steps.changed-files.outputs.any_changed == 'true'
168      uses: docker/build-push-action@v3
169      with:
170        context: ./bouncer
171        push: true
172        tags: ${{ steps.bouncermeta.outputs.tags }}
173        labels: ${{ steps.bouncermeta.outputs.labels }}
174        platforms: ${{ env.PLATFORMS }}
175        cache-from: type=gha
176        cache-to: type=gha,mode=max
177  build-caddy:
178    runs-on: ubuntu-22.04
179    needs: test
180    steps:
181    - name: Checkout repo
182      uses: actions/checkout@v3
183    - name: Get changed files
184      id: changed-files
185      uses: tj-actions/changed-files@v40
186      with:
187        files: caddy/**
188    - name: Setup docker
189      if: steps.changed-files.outputs.any_changed == 'true'
190      uses: ./.github/actions/setup
191      with:
192        registry: ${{ env.REGISTRY }}
193        username: ${{ github.actor }}
194        password: ${{ secrets.GITHUB_TOKEN }}
195    - name: Collect caddy image metadata
196      if: steps.changed-files.outputs.any_changed == 'true'
197      id: caddymeta
198      uses: docker/metadata-action@v4
199      with:
200        images: ${{ env.REGISTRY }}/${{ github.repository }}/caddy
201    - name: Build and push
202      if: steps.changed-files.outputs.any_changed == 'true'
203      uses: docker/build-push-action@v3
204      with:
205        context: ./caddy
206        push: true
207        tags: ${{ steps.caddymeta.outputs.tags }}
208        labels: ${{ steps.caddymeta.outputs.labels }}
209        platforms: ${{ env.PLATFORMS }}
210        cache-from: type=gha
211        cache-to: type=gha,mode=max