-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #913 from Health-Informatics-UoN/feat/863/add-rele…
…ase-workflow Add publish workflow
- Loading branch information
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Publish release images to Github Registry | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
env: | ||
app-name: carrot | ||
repo-owner: ${{ github.repository_owner }} | ||
registry: ghcr.io | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Docker Login | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ env.registry }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set timestamp env var | ||
run: echo "RUN_TIMESTAMP=$(TZ="Etc/UTC" date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
|
||
# Tag and build frontend | ||
- name: Extract frontend Docker metadata | ||
id: frontend_meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend | ||
tags: | | ||
${{ github.event.release.tag_name }} | ||
${{ github.sha }} | ||
${{ env.RUN_TIMESTAMP }} | ||
- name: Build and push frontend image | ||
uses: docker/[email protected] | ||
with: | ||
context: ./app/next-client-app | ||
file: ./app/next-client-app/Dockerfile | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.frontend_meta.outputs.tags }} | ||
|
||
# Tag and for backend | ||
- name: Extract backend Docker metadata | ||
id: backend_meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend | ||
tags: | | ||
${{ github.event.release.tag_name }} | ||
${{ github.sha }} | ||
${{ env.RUN_TIMESTAMP }} | ||
- name: Build and push backend image | ||
uses: docker/[email protected] | ||
with: | ||
file: ./app/Dockerfile.deploy | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.backend_meta.outputs.tags }} | ||
|
||
# Tag and for workers | ||
- name: Extract workers Docker metadata | ||
id: workers_meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/workers | ||
tags: | | ||
${{ github.event.release.tag_name }} | ||
${{ github.sha }} | ||
${{ env.RUN_TIMESTAMP }} | ||
- name: Build and push workers image | ||
uses: docker/[email protected] | ||
with: | ||
context: ./app | ||
file: ./app/workers/Dockerfile | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.workers_meta.outputs.tags }} |