element-web/.github/workflows/dockerhub.yaml

95 lines
3.5 KiB
YAML
Raw Normal View History

name: Dockerhub
on:
2022-12-09 12:28:29 +00:00
workflow_dispatch: {}
push:
tags: [v*]
schedule:
# This job can take a while, and we have usage limits, so just publish develop only twice a day
- cron: "0 7/12 * * *"
2023-03-30 12:55:09 +00:00
concurrency: ${{ github.workflow }}-${{ github.ref_name }}
permissions:
id-token: write # needed for signing the images with GitHub OIDC Token
jobs:
2022-12-09 12:28:29 +00:00
buildx:
name: Docker Buildx
runs-on: ubuntu-latest
environment: dockerhub
strategy:
fail-fast: false
matrix:
include:
- variant: vanilla
# Variant we ship to aid ESS in providing a build on the OpenCoDE platform including specific modules
- variant: opendesk
flavor: suffix=-opendesk,onlatest=true
prepare: mv variants/openDesk/* .
2022-12-09 12:28:29 +00:00
steps:
- uses: actions/checkout@v4
2022-12-09 12:28:29 +00:00
with:
fetch-depth: 0 # needed for docker-package to be able to calculate the version
- name: Install Cosign
uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 # v3
- name: Prepare
if: matrix.prepare
run: ${{ matrix.prepare }}
2022-12-09 12:28:29 +00:00
- name: Set up QEMU
2024-07-24 11:40:31 +00:00
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
2022-12-09 12:28:29 +00:00
- name: Set up Docker Buildx
2024-08-22 14:37:44 +00:00
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
2022-12-09 12:28:29 +00:00
with:
install: true
2022-12-09 12:28:29 +00:00
- name: Login to Docker Hub
2024-07-24 11:40:31 +00:00
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
2022-12-09 12:28:29 +00:00
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
2022-12-09 12:28:29 +00:00
- name: Docker meta
id: meta
2024-03-05 14:43:09 +00:00
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5
2022-12-09 12:28:29 +00:00
with:
images: |
vectorim/element-web
tags: |
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=${{ contains(github.ref_name, '-rc.') && 'false' || 'auto' }}
${{ matrix.flavor }}
2022-12-09 12:28:29 +00:00
- name: Build and push
id: build-and-push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
2022-12-09 12:28:29 +00:00
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Sign the images with GitHub OIDC Token
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
TAGS: ${{ steps.meta.outputs.tags }}
run: |
images=""
for tag in ${TAGS}; do
images+="${tag}@${DIGEST} "
done
cosign sign --yes ${images}
2022-12-09 12:28:29 +00:00
- name: Update repo description
if: matrix.variant == 'vanilla'
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4
2022-12-09 12:28:29 +00:00
continue-on-error: true
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: vectorim/element-web