2022-12-07 17:43:47 +00:00
|
|
|
name: Docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-05-09 13:31:40 +00:00
|
|
|
branches:
|
|
|
|
- "main"
|
2023-05-07 11:46:04 +00:00
|
|
|
tags:
|
2023-05-23 18:53:53 +00:00
|
|
|
- "*"
|
2023-05-09 13:31:40 +00:00
|
|
|
env:
|
|
|
|
# Docker & Registries
|
|
|
|
ARCHITECTURES: linux/amd64,linux/arm64
|
|
|
|
IMAGE_NAME: silverbullet
|
|
|
|
NAMESPACE_GITHUB: silverbulletmd
|
|
|
|
NAMESPACE_DOCKER: zefhemel
|
2022-12-07 17:43:47 +00:00
|
|
|
jobs:
|
2023-05-23 18:53:53 +00:00
|
|
|
docker-main:
|
2022-12-07 17:43:47 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Setup repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2023-05-09 13:31:40 +00:00
|
|
|
- name: Set up QEMU for multi-arch builds with buildx
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
with:
|
|
|
|
platforms: ${{ env.ARCHITECTURES }}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
with:
|
|
|
|
platforms: ${{ env.ARCHITECTURES }}
|
|
|
|
|
2022-12-07 17:43:47 +00:00
|
|
|
- name: Setup Deno
|
2023-06-13 18:52:47 +00:00
|
|
|
uses: denoland/setup-deno@v1
|
2022-12-07 17:43:47 +00:00
|
|
|
with:
|
2023-10-03 12:16:33 +00:00
|
|
|
deno-version: v1.37
|
2023-06-13 18:52:47 +00:00
|
|
|
|
2022-12-07 17:43:47 +00:00
|
|
|
- name: Run bundle build
|
|
|
|
run: |
|
|
|
|
deno task build
|
|
|
|
deno task bundle
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2023-05-09 13:31:40 +00:00
|
|
|
- name: Log in to the ghcr Container registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
#
|
|
|
|
# MetaData Extract Docu: <https://github.com/docker/metadata-action>
|
|
|
|
#
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4.4.0
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
# Set the different image names(paces) for docker-hub & ghcr
|
|
|
|
${{ env.NAMESPACE_DOCKER }}/${{ env.IMAGE_NAME }}
|
|
|
|
ghcr.io/${{ env.NAMESPACE_GITHUB }}/${{ env.IMAGE_NAME }}
|
|
|
|
tags: |
|
2023-07-24 13:01:39 +00:00
|
|
|
# When pushing a tag, release a tagged release :x.x.x
|
2023-05-09 13:31:40 +00:00
|
|
|
type=semver,pattern={{raw}},enable=true
|
2023-07-24 13:01:39 +00:00
|
|
|
# When pushing a tag (type=semver) push to :latest too
|
2023-07-24 13:15:15 +00:00
|
|
|
type=semver,pattern=latest,enable=true
|
2023-07-24 13:01:39 +00:00
|
|
|
# When pushing to main branch, release as :edge
|
|
|
|
type=edge,branch=main
|
2023-05-23 18:53:53 +00:00
|
|
|
- name: Build and push main docker images
|
2023-05-09 13:31:40 +00:00
|
|
|
uses: docker/build-push-action@v4.0.0
|
2022-12-07 17:43:47 +00:00
|
|
|
with:
|
|
|
|
context: .
|
2023-05-09 13:31:40 +00:00
|
|
|
platforms: ${{ env.ARCHITECTURES }}
|
2022-12-07 17:43:47 +00:00
|
|
|
push: true
|
2023-05-23 18:53:53 +00:00
|
|
|
file: Dockerfile
|
2023-05-09 13:31:40 +00:00
|
|
|
# Disable to get rid of unknown architecture in ghcr
|
|
|
|
provenance: false
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|