|
8 | 8 | - server/**
|
9 | 9 | workflow_dispatch:
|
10 | 10 |
|
| 11 | +env: |
| 12 | + REGISTRY: ghcr.io |
| 13 | + |
11 | 14 | jobs:
|
12 |
| - build: |
| 15 | + build-and-push-backend-image: |
| 16 | + runs-on: [self-hosted, linux, X64] |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + |
| 21 | + env: |
| 22 | + IMAGE_NAME: ${{ github.repository }} |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Set up Docker Buildx |
| 26 | + uses: docker/setup-buildx-action@v3 |
| 27 | + with: |
| 28 | + config-inline: | |
| 29 | + [registry."docker.io"] |
| 30 | + mirrors = ["https://github-runner-dockerhub-cache.canonical.com:5000"] |
| 31 | +
|
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v3 |
| 34 | + |
| 35 | + - name: Log in to the Container registry |
| 36 | + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 37 | + with: |
| 38 | + registry: ${{ env.REGISTRY }} |
| 39 | + username: ${{ github.actor }} |
| 40 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + - name: Extract metadata (tags, labels) for Docker |
| 43 | + id: meta |
| 44 | + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
| 45 | + with: |
| 46 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 47 | + |
| 48 | + - name: Build and push backend Docker image |
| 49 | + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
| 50 | + with: |
| 51 | + context: ./server |
| 52 | + push: true |
| 53 | + tags: ${{ steps.meta.outputs.tags }} |
| 54 | + labels: ${{ steps.meta.outputs.labels }} |
| 55 | + |
| 56 | + build-and-push-charm: |
13 | 57 | name: Release to Charmhub
|
14 | 58 | runs-on: [self-hosted, linux, X64]
|
15 | 59 | steps:
|
16 | 60 | - name: Checkout
|
17 | 61 | uses: actions/checkout@v2
|
18 |
| - with: |
19 |
| - fetch-depth: 0 |
20 | 62 | - name: Upload charm to charmhub
|
21 | 63 | uses: canonical/charming-actions/[email protected]
|
22 | 64 | with:
|
23 | 65 | charm-path: server/charm
|
24 | 66 | credentials: "${{ secrets.CHARMHUB_TOKEN }}"
|
25 | 67 | github-token: "${{ secrets.GITHUB_TOKEN }}"
|
26 |
| - upload-image: "true" |
27 | 68 | channel: "latest/edge"
|
0 commit comments