Merge pull request #304 from nextcloud/dependabot/npm_and_yarn/main/n… #174
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
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors | |
# SPDX-License-Identifier: MIT | |
name: Docker image | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- main | |
- master | |
- stable* | |
env: | |
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/whiteboard | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- name: Set vars | |
id: vars | |
run: | | |
echo "version_channel=${{ github.event_name == 'release' && 'release' || 'daily' }}" >> $GITHUB_OUTPUT | |
echo "version=${{ github.sha }}" >> $GITHUB_OUTPUT | |
echo "platform=$(echo -n ${{ matrix.platform }} | sed 's/\//-/g')" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docker images | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
platforms: ${{ matrix.platform }} | |
provenance: false | |
tags: | | |
${{ env.GHCR_REPO}}:${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.platform }} | |
release: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
needs: build | |
steps: | |
- name: Set vars | |
id: vars | |
run: | | |
echo "version_channel=${{ github.event_name == 'release' && 'release' || 'daily' }}" >> $GITHUB_OUTPUT | |
echo "version_ref=${{ github.event_name == 'release' && github.ref_name || github.sha }}" >> $GITHUB_OUTPUT | |
echo "version=${{ github.sha }}" >> $GITHUB_OUTPUT | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GHCR manifest | |
run: | | |
docker manifest create $GHCR_REPO:${{ steps.vars.outputs.version_ref }} \ | |
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \ | |
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-arm64 | |
docker manifest create $GHCR_REPO:${{ steps.vars.outputs.version_channel }} \ | |
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \ | |
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-arm64 | |
- name: Push manifests | |
run: | | |
docker manifest push $GHCR_REPO:${{ steps.vars.outputs.version_ref }} | |
docker manifest push $GHCR_REPO:${{ steps.vars.outputs.version_channel }} |