Skip to content

Commit e36b6fe

Browse files
committed
consolidate server github workflows to avoid race
1 parent b86ef6d commit e36b6fe

File tree

2 files changed

+45
-57
lines changed

2 files changed

+45
-57
lines changed

.github/workflows/server-charm-release-edge.yml

+45-4
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,61 @@ on:
88
- server/**
99
workflow_dispatch:
1010

11+
env:
12+
REGISTRY: ghcr.io
13+
1114
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:
1357
name: Release to Charmhub
1458
runs-on: [self-hosted, linux, X64]
1559
steps:
1660
- name: Checkout
1761
uses: actions/checkout@v2
18-
with:
19-
fetch-depth: 0
2062
- name: Upload charm to charmhub
2163
uses: canonical/charming-actions/[email protected]
2264
with:
2365
charm-path: server/charm
2466
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
2567
github-token: "${{ secrets.GITHUB_TOKEN }}"
26-
upload-image: "true"
2768
channel: "latest/edge"

.github/workflows/server-publish-oci-image.yml

-53
This file was deleted.

0 commit comments

Comments
 (0)