|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + REGISTRY: ghcr.io |
| 10 | + IMAGE_PREFIX: ${{ github.repository_owner }}/glean |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-backend: |
| 14 | + name: Build Backend Image |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + packages: write |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up QEMU |
| 25 | + uses: docker/setup-qemu-action@v3 |
| 26 | + |
| 27 | + - name: Set up Docker Buildx |
| 28 | + uses: docker/setup-buildx-action@v3 |
| 29 | + |
| 30 | + - name: Log in to Container Registry |
| 31 | + uses: docker/login-action@v3 |
| 32 | + with: |
| 33 | + registry: ${{ env.REGISTRY }} |
| 34 | + username: ${{ github.actor }} |
| 35 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + |
| 37 | + - name: Extract metadata |
| 38 | + id: meta |
| 39 | + uses: docker/metadata-action@v5 |
| 40 | + with: |
| 41 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-backend |
| 42 | + tags: | |
| 43 | + type=semver,pattern={{version}} |
| 44 | + type=semver,pattern={{major}}.{{minor}} |
| 45 | + type=semver,pattern={{major}} |
| 46 | + type=raw,value=latest,enable={{is_default_branch}} |
| 47 | +
|
| 48 | + - name: Build and push Backend image |
| 49 | + uses: docker/build-push-action@v5 |
| 50 | + with: |
| 51 | + context: ./backend |
| 52 | + file: ./backend/Dockerfile |
| 53 | + platforms: linux/amd64,linux/arm64 |
| 54 | + push: true |
| 55 | + tags: ${{ steps.meta.outputs.tags }} |
| 56 | + labels: ${{ steps.meta.outputs.labels }} |
| 57 | + cache-from: type=gha |
| 58 | + cache-to: type=gha,mode=max |
| 59 | + |
| 60 | + build-web: |
| 61 | + name: Build Web Frontend Image |
| 62 | + runs-on: ubuntu-latest |
| 63 | + permissions: |
| 64 | + contents: read |
| 65 | + packages: write |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Checkout repository |
| 69 | + uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Set up QEMU |
| 72 | + uses: docker/setup-qemu-action@v3 |
| 73 | + |
| 74 | + - name: Set up Docker Buildx |
| 75 | + uses: docker/setup-buildx-action@v3 |
| 76 | + |
| 77 | + - name: Log in to Container Registry |
| 78 | + uses: docker/login-action@v3 |
| 79 | + with: |
| 80 | + registry: ${{ env.REGISTRY }} |
| 81 | + username: ${{ github.actor }} |
| 82 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + |
| 84 | + - name: Extract metadata |
| 85 | + id: meta |
| 86 | + uses: docker/metadata-action@v5 |
| 87 | + with: |
| 88 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-web |
| 89 | + tags: | |
| 90 | + type=semver,pattern={{version}} |
| 91 | + type=semver,pattern={{major}}.{{minor}} |
| 92 | + type=semver,pattern={{major}} |
| 93 | + type=raw,value=latest,enable={{is_default_branch}} |
| 94 | +
|
| 95 | + - name: Build and push Web image |
| 96 | + uses: docker/build-push-action@v5 |
| 97 | + with: |
| 98 | + context: ./frontend |
| 99 | + file: ./frontend/apps/web/Dockerfile |
| 100 | + platforms: linux/amd64,linux/arm64 |
| 101 | + push: true |
| 102 | + tags: ${{ steps.meta.outputs.tags }} |
| 103 | + labels: ${{ steps.meta.outputs.labels }} |
| 104 | + cache-from: type=gha |
| 105 | + cache-to: type=gha,mode=max |
| 106 | + |
| 107 | + build-admin: |
| 108 | + name: Build Admin Dashboard Image |
| 109 | + runs-on: ubuntu-latest |
| 110 | + permissions: |
| 111 | + contents: read |
| 112 | + packages: write |
| 113 | + |
| 114 | + steps: |
| 115 | + - name: Checkout repository |
| 116 | + uses: actions/checkout@v4 |
| 117 | + |
| 118 | + - name: Set up QEMU |
| 119 | + uses: docker/setup-qemu-action@v3 |
| 120 | + |
| 121 | + - name: Set up Docker Buildx |
| 122 | + uses: docker/setup-buildx-action@v3 |
| 123 | + |
| 124 | + - name: Log in to Container Registry |
| 125 | + uses: docker/login-action@v3 |
| 126 | + with: |
| 127 | + registry: ${{ env.REGISTRY }} |
| 128 | + username: ${{ github.actor }} |
| 129 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 130 | + |
| 131 | + - name: Extract metadata |
| 132 | + id: meta |
| 133 | + uses: docker/metadata-action@v5 |
| 134 | + with: |
| 135 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-admin |
| 136 | + tags: | |
| 137 | + type=semver,pattern={{version}} |
| 138 | + type=semver,pattern={{major}}.{{minor}} |
| 139 | + type=semver,pattern={{major}} |
| 140 | + type=raw,value=latest,enable={{is_default_branch}} |
| 141 | +
|
| 142 | + - name: Build and push Admin image |
| 143 | + uses: docker/build-push-action@v5 |
| 144 | + with: |
| 145 | + context: ./frontend |
| 146 | + file: ./frontend/apps/admin/Dockerfile |
| 147 | + platforms: linux/amd64,linux/arm64 |
| 148 | + push: true |
| 149 | + tags: ${{ steps.meta.outputs.tags }} |
| 150 | + labels: ${{ steps.meta.outputs.labels }} |
| 151 | + cache-from: type=gha |
| 152 | + cache-to: type=gha,mode=max |
| 153 | + |
| 154 | + create-release: |
| 155 | + name: Create GitHub Release |
| 156 | + needs: [build-backend, build-web, build-admin] |
| 157 | + runs-on: ubuntu-latest |
| 158 | + permissions: |
| 159 | + contents: write |
| 160 | + |
| 161 | + steps: |
| 162 | + - name: Checkout repository |
| 163 | + uses: actions/checkout@v4 |
| 164 | + |
| 165 | + - name: Create Release |
| 166 | + uses: softprops/action-gh-release@v1 |
| 167 | + with: |
| 168 | + generate_release_notes: true |
| 169 | + body: | |
| 170 | + ## Docker Images |
| 171 | + |
| 172 | + This release includes the following Docker images: |
| 173 | + |
| 174 | + - `ghcr.io/${{ env.IMAGE_PREFIX }}-backend:${{ github.ref_name }}` |
| 175 | + - `ghcr.io/${{ env.IMAGE_PREFIX }}-web:${{ github.ref_name }}` |
| 176 | + - `ghcr.io/${{ env.IMAGE_PREFIX }}-admin:${{ github.ref_name }}` |
| 177 | + |
| 178 | + ## Quick Start |
| 179 | + |
| 180 | + ```bash |
| 181 | + # Download docker-compose.yml |
| 182 | + curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/docker-compose.yml -o docker-compose.yml |
| 183 | + |
| 184 | + # Start Glean |
| 185 | + docker compose up -d |
| 186 | + |
| 187 | + # Access at http://localhost |
| 188 | + ``` |
| 189 | + |
| 190 | + See [README](https://github.com/${{ github.repository }}#quick-start) for full documentation. |
| 191 | + env: |
| 192 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 193 | + |
0 commit comments