Skip to content

Commit 5ae70ac

Browse files
committed
Refactor CI
1 parent dcf1aa4 commit 5ae70ac

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1-
name: release
1+
name: Build and Release
22
on:
33
push:
44
tags:
55
- "v*.*.*"
66
env:
7-
BUILD_IMAGE: bedasoftware/fhir-sdc
8-
CACHE_IMAGE: bedasoftware/fhir-sdc:latest
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
99
jobs:
10-
Release:
10+
build-and-push-images:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
1215
steps:
13-
- name: Login to Docker Hub
14-
uses: docker/login-action@v1
15-
with:
16-
username: ${{ secrets.DOCKER_HUB_USERNAME }}
17-
password: ${{ secrets.DOCKER_HUB_TOKEN }}
18-
- uses: actions/checkout@v2
19-
- run: docker pull ${{ env.CACHE_IMAGE }} || true
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
2018
- name: Extract branch name
2119
shell: bash
2220
run: echo "branch=$(echo ${GITHUB_REF#refs/tags/v})" >>$GITHUB_OUTPUT
2321
id: extract_branch
24-
- name: Set up Docker Buildx
25-
id: buildx
26-
uses: docker/setup-buildx-action@v1
27-
- run: docker run --rm --privileged tonistiigi/binfmt --install all
28-
- run: >-
29-
docker buildx build --platform linux/arm64,linux/amd64
30-
--cache-from ${{ env.CACHE_IMAGE }} --push
31-
--tag ${{ env.BUILD_IMAGE }}:${{ steps.extract_branch.outputs.branch }} --tag ${{ env.CACHE_IMAGE }} .
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
- name: Build and push Docker image (With commit hash)
34+
uses: docker/build-push-action@6
35+
with:
36+
context: .
37+
push: true
38+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}
39+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)