Release cli/v2.0.0-rc.1 #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |