Aethel Bot OSS repository! aethel.xyz
bot fun ai discord discord-bot aethel
at dev 1.6 kB view raw
1name: Docker Build and Publish 2 3on: 4 push: 5 branches: 6 - main 7 - dev 8 tags: 9 - "v*" 10 pull_request: 11 branches: 12 - main 13 14env: 15 REGISTRY: ghcr.io 16 IMAGE_NAME: ${{ github.repository }} 17 18jobs: 19 build: 20 runs-on: ubuntu-latest 21 permissions: 22 contents: read 23 packages: write 24 25 steps: 26 - name: Checkout repository 27 uses: actions/checkout@v4 28 29 - name: Set up Docker Buildx 30 uses: docker/setup-buildx-action@v3 31 with: 32 install: true 33 34 - name: Log in to Container Registry 35 if: github.event_name != 'pull_request' 36 uses: docker/login-action@v3 37 with: 38 registry: ${{ env.REGISTRY }} 39 username: ${{ github.actor }} 40 password: ${{ secrets.GITHUB_TOKEN }} 41 42 - name: Extract metadata 43 id: meta 44 uses: docker/metadata-action@v5 45 with: 46 images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 47 tags: | 48 type=ref,event=branch 49 type=ref,event=pr 50 type=semver,pattern={{version}} 51 type=semver,pattern={{major}}.{{minor}} 52 type=semver,pattern={{major}} 53 type=raw,value=latest,enable={{is_default_branch}} 54 55 - name: Build and push Docker image 56 uses: docker/build-push-action@v5 57 with: 58 context: . 59 push: ${{ github.event_name != 'pull_request' }} 60 tags: ${{ steps.meta.outputs.tags }} 61 labels: ${{ steps.meta.outputs.labels }} 62 build-args: | 63 SOURCE_COMMIT=${{ github.sha }} 64 cache-from: type=gha 65 cache-to: type=gha,mode=max