Skip to content

Move latest tag to full image, update docs #2

Move latest tag to full image, update docs

Move latest tag to full image, update docs #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Image tag (e.g. v0.1.0). Defaults to git ref."
required: false
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/spacedriveapp/spacebot
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine version tag
id: version
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
VERSION="${{ github.event.inputs.tag }}"
elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
VERSION="dev-$(echo $GITHUB_SHA | head -c 7)"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build and push slim
uses: docker/build-push-action@v6
with:
context: .
target: slim
push: true
tags: |
${{ env.IMAGE }}:${{ steps.version.outputs.version }}-slim
${{ env.IMAGE }}:slim
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push full
uses: docker/build-push-action@v6
with:
context: .
target: full
push: true
tags: |
${{ env.IMAGE }}:${{ steps.version.outputs.version }}-full
${{ env.IMAGE }}:full
${{ env.IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
generate_release_notes: true