2021-12-21 00:58:37 +08:00
|
|
|
name: Build & publish images to the package registry for tags
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
2023-08-08 17:29:22 +08:00
|
|
|
push:
|
|
|
|
branches: [livekit]
|
2021-12-21 00:58:37 +08:00
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build & publish
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
2023-01-03 18:48:48 +08:00
|
|
|
contents: write # required to upload release asset
|
2021-12-21 00:58:37 +08:00
|
|
|
packages: write
|
|
|
|
steps:
|
2023-08-09 22:45:56 +08:00
|
|
|
- name: Get current time
|
|
|
|
id: current-time
|
|
|
|
run: echo "unix_time=$(date +'%s')" >> $GITHUB_OUTPUT
|
2023-08-09 22:32:17 +08:00
|
|
|
|
2021-12-21 00:58:37 +08:00
|
|
|
- name: Check it out
|
2023-09-19 17:24:34 +08:00
|
|
|
uses: actions/checkout@v4
|
2021-12-21 00:58:37 +08:00
|
|
|
|
|
|
|
- name: Log in to container registry
|
2023-11-22 23:37:02 +08:00
|
|
|
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb
|
2021-12-21 00:58:37 +08:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-01-03 18:48:48 +08:00
|
|
|
- name: Yarn cache
|
2023-10-24 00:19:30 +08:00
|
|
|
uses: actions/setup-node@v4
|
2023-01-03 18:48:48 +08:00
|
|
|
with:
|
|
|
|
cache: "yarn"
|
|
|
|
- name: Install dependencies
|
|
|
|
run: "yarn install"
|
|
|
|
- name: Build
|
|
|
|
run: "yarn run build"
|
|
|
|
env:
|
|
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
|
|
|
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
2023-08-11 16:04:38 +08:00
|
|
|
VITE_APP_VERSION: ${{ github.event.release.tag_name || github.sha }}
|
2023-01-03 18:48:48 +08:00
|
|
|
|
|
|
|
- name: Create Tarball
|
|
|
|
env:
|
2023-08-08 18:59:06 +08:00
|
|
|
TARBALL_VERSION: ${{ github.event.release.tag_name || github.sha }}
|
2023-01-03 18:48:48 +08:00
|
|
|
run: |
|
2023-08-08 18:51:21 +08:00
|
|
|
tar --numeric-owner --transform "s/dist/element-call-${TARBALL_VERSION}/" -cvzf element-call-${TARBALL_VERSION}.tar.gz dist
|
|
|
|
|
2023-01-03 18:48:48 +08:00
|
|
|
- name: Upload
|
2024-02-06 06:52:07 +08:00
|
|
|
uses: actions/upload-artifact@4c0ff1c489dca52fedb26375d7d8fe7bd9233f19
|
2023-01-03 18:48:48 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
with:
|
2023-08-08 21:14:12 +08:00
|
|
|
path: "./element-call-*.tar.gz"
|
2023-01-03 18:48:48 +08:00
|
|
|
|
2021-12-21 00:58:37 +08:00
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2024-02-01 12:26:22 +08:00
|
|
|
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
|
2021-12-21 00:58:37 +08:00
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2023-08-08 17:29:22 +08:00
|
|
|
tags: |
|
|
|
|
type=sha,format=short,event=branch
|
2023-08-11 16:24:11 +08:00
|
|
|
type=semver,pattern=v{{version}}
|
2023-08-08 17:29:22 +08:00
|
|
|
type=raw,value=latest-ci,enable={{is_default_branch}}
|
2023-08-09 23:18:34 +08:00
|
|
|
type=raw,value=latest-ci_${{steps.current-time.outputs.unix_time}},enable={{is_default_branch}}
|
2021-12-21 00:58:37 +08:00
|
|
|
|
2022-06-01 01:14:42 +08:00
|
|
|
- name: Set up Docker Buildx
|
2023-12-01 22:03:29 +08:00
|
|
|
uses: docker/setup-buildx-action@edfb0fe6204400c56fbfd3feba3fe9ad1adfa345
|
2022-06-01 01:14:42 +08:00
|
|
|
|
2021-12-21 00:58:37 +08:00
|
|
|
- name: Build and push Docker image
|
2024-02-03 23:16:56 +08:00
|
|
|
uses: docker/build-push-action@4976231911ebf5f32aad765192d35f942aa48cb8
|
2021-12-21 00:58:37 +08:00
|
|
|
with:
|
|
|
|
context: .
|
2022-06-01 01:14:42 +08:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-12-21 00:58:37 +08:00
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|