Skip to content

Build Docker container #320

Build Docker container

Build Docker container #320

Workflow file for this run

name: Build Docker container
on:
workflow_dispatch:
push:
branches:
- 'main'
schedule:
- cron: '0 1 * * *'
concurrency:
group: '${{ github.workflow }}'
cancel-in-progress: true
jobs:
gather:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.gather.outputs.tags }}
latest: ${{ steps.gather.outputs.latest }}
steps:
- name: Find latest version
id: gather
run: |
VERSION=`curl -s https://registry.npmjs.org/replaywebpage/latest | jq -r .version`
echo "tags=['$VERSION']" >>$GITHUB_OUTPUT
echo "latest=$VERSION" >>$GITHUB_OUTPUT
cat $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: [gather]
strategy:
fail-fast: false
matrix:
tag: ${{ fromJson(needs.gather.outputs.tags) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ matrix.tag }}
type=raw,value=latest,enable=${{ matrix.tag == needs.gather.outputs.latest }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
id: build
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.output.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: VERSION=${{ matrix.tag }}