Merge pull request #332 from citrineos/rc-1.5.1 #28
Workflow file for this run
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
name: Push Release Tagged Server | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
image: | |
- name: citrineos-server | |
context: ./ | |
dockerfile: ./Server/deploy.Dockerfile | |
config: '' | |
- name: citrineos-directus | |
context: ./DirectusExtensions | |
dockerfile: ./DirectusExtensions/directus.Dockerfile | |
config: ./Server/directus-env-config.cjs | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build image | |
run: | | |
docker buildx build \ | |
--file ${{ matrix.image.dockerfile }} \ | |
--tag ${{ matrix.image.name }} \ | |
--cache-from type=local,src=/tmp/.buildx-cache \ | |
--cache-to type=local,dest=/tmp/.buildx-cache \ | |
--load \ | |
${{ matrix.image.context }} | |
- name: Copy config file to Directus container | |
if: ${{ matrix.image.name == 'citrineos-directus' }} | |
run: | | |
container_id=$(docker create ${{ matrix.image.name }}) | |
docker cp ${{ matrix.image.config }} $container_id:/directus/config.cjs | |
docker commit $container_id ${{ matrix.image.name }} | |
docker rm $container_id | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ matrix.image.name }} | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
VERSION=$(echo $VERSION | sed -e 's/^v//') | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag ${{ matrix.image.name }} $IMAGE_ID:$VERSION | |
docker tag ${{ matrix.image.name }} $IMAGE_ID:latest | |
docker push $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:latest |