68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
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:
|
|
-
|
|
name: Check out
|
|
uses: actions/checkout@v2
|
|
-
|
|
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 }}
|
|
-
|
|
name: Set up Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 'lts/*'
|
|
-
|
|
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 .
|
|
-
|
|
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}}
|
|
-
|
|
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 }}
|
|
-
|
|
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 }}
|