repos / pico

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

pico / .github / workflows
Eric Bower  ·  2025-01-18

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-bouncer:
 85    runs-on: ubuntu-22.04
 86    needs: test
 87    steps:
 88    - name: Checkout repo
 89      uses: actions/checkout@v3
 90    - name: Get changed files
 91      id: changed-files
 92      uses: tj-actions/changed-files@v40
 93      with:
 94        files: bouncer/**
 95    - name: Setup docker
 96      if: steps.changed-files.outputs.any_changed == 'true'
 97      uses: ./.github/actions/setup
 98      with:
 99        registry: ${{ env.REGISTRY }}
100        username: ${{ github.actor }}
101        password: ${{ secrets.GITHUB_TOKEN }}
102    - name: Collect bouncer image metadata
103      if: steps.changed-files.outputs.any_changed == 'true'
104      id: bouncermeta
105      uses: docker/metadata-action@v4
106      with:
107        images: ${{ env.REGISTRY }}/${{ github.repository }}/bouncer
108    - name: Build and push
109      if: steps.changed-files.outputs.any_changed == 'true'
110      uses: docker/build-push-action@v3
111      with:
112        context: ./bouncer
113        push: true
114        tags: ${{ steps.bouncermeta.outputs.tags }}
115        labels: ${{ steps.bouncermeta.outputs.labels }}
116        platforms: ${{ env.PLATFORMS }}
117        cache-from: type=gha
118        cache-to: type=gha,mode=max
119  build-caddy:
120    runs-on: ubuntu-22.04
121    needs: test
122    steps:
123    - name: Checkout repo
124      uses: actions/checkout@v3
125    - name: Get changed files
126      id: changed-files
127      uses: tj-actions/changed-files@v40
128      with:
129        files: caddy/**
130    - name: Setup docker
131      if: steps.changed-files.outputs.any_changed == 'true'
132      uses: ./.github/actions/setup
133      with:
134        registry: ${{ env.REGISTRY }}
135        username: ${{ github.actor }}
136        password: ${{ secrets.GITHUB_TOKEN }}
137    - name: Collect caddy image metadata
138      if: steps.changed-files.outputs.any_changed == 'true'
139      id: caddymeta
140      uses: docker/metadata-action@v4
141      with:
142        images: ${{ env.REGISTRY }}/${{ github.repository }}/caddy
143    - name: Build and push
144      if: steps.changed-files.outputs.any_changed == 'true'
145      uses: docker/build-push-action@v3
146      with:
147        context: ./caddy
148        push: true
149        tags: ${{ steps.caddymeta.outputs.tags }}
150        labels: ${{ steps.caddymeta.outputs.labels }}
151        platforms: ${{ env.PLATFORMS }}
152        cache-from: type=gha
153        cache-to: type=gha,mode=max