etherpad-lite/.github/workflows/docker.yml

75 lines
1.9 KiB
YAML
Raw Normal View History

name: Docker
on:
pull_request:
push:
branches:
- 'develop'
tags:
- 'v?[0-9]+.[0-9]+.[0-9]+'
env:
TEST_TAG: etherpad/etherpad:test
jobs:
docker:
runs-on: ubuntu-latest
steps:
2022-01-27 23:43:05 +01:00
-
name: Check out
2022-03-01 23:17:16 +01:00
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and export to Docker
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
2022-01-27 23:47:28 +01:00
cache-from: type=gha
cache-to: type=gha,mode=max
-
name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
2022-01-27 23:47:28 +01:00
cache: 'npm'
cache-dependency-path: |
src/package-lock.json
src/bin/doc/package-lock.json
-
name: Test
run: |
docker run --rm -d -p 9001:9001 ${{ env.TEST_TAG }}
./src/bin/installDeps.sh
sleep 3
(cd src && npm run test-container)
git clean -dxf .
2022-01-27 23:43:05 +01:00
-
name: Docker meta
if: github.event_name == 'push'
id: meta
uses: docker/metadata-action@v3
with:
images: etherpad/etherpad
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
2022-01-27 23:43:05 +01:00
-
name: Log in to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
2022-01-27 23:43:05 +01:00
-
name: Build and push
if: github.event_name == 'push'
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}