-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.75 KB
/
docker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Build and publish Docker Image if a new Github release was created
on:
release:
types: [created]
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Check if the release tag starts with 'server'
id: check_tag
run: |
if [[ ! "${GITHUB_REF_NAME}" =~ ^server ]]; then
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
shell: bash
- name: Skip build if tag does not start with 'server'
if: steps.check_tag.outputs.skip == 'true'
run: echo "Skipping build because the tag does not start with 'server'."
- name: Check out the repo
if: steps.check_tag.outputs.skip == 'false'
uses: actions/checkout@v2
- name: Set up Docker Buildx
if: steps.check_tag.outputs.skip == 'false'
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
if: steps.check_tag.outputs.skip == 'false'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Sanitize ref name
id: sanitize
if: steps.check_tag.outputs.skip == 'false'
run: echo "SANITIZED_REF_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
- name: Build and push
if: steps.check_tag.outputs.skip == 'false'
uses: docker/build-push-action@v2
with:
context: ./app/
file: ./app/Dockerfile.server
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/plandex-server:${{ env.SANITIZED_REF_NAME }}
ghcr.io/${{ github.repository_owner }}/plandex-server:latest