Build & Deploy / build-and-deploy (push) Successful in 1m53s
Gitea's expression parser only supports top-level builtin functions, not method calls (gitea.sha.substring(0, 7) left 5 tokens unparsed). Use the full SHA; there is no substring/slice function to shorten it.
30 lines
740 B
YAML
30 lines
740 B
YAML
# This workflow builds DOStalgia whenever code is pushed to main.
|
|
# The runner has Docker socket access so it can manage containers on the host.
|
|
# See: https://docs.gitea.com/usage/actions
|
|
|
|
name: Build & Deploy
|
|
run-name: Build ${{ gitea.sha }}
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
IMAGE_NAME: dostalgia
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t ${{ env.IMAGE_NAME }}:${{ gitea.sha }} .
|
|
docker tag ${{ env.IMAGE_NAME }}:${{ gitea.sha }} ${{ env.IMAGE_NAME }}:latest
|
|
|
|
- name: Clean up old images
|
|
run: docker image prune -f --filter "until=24h"
|