notatio/.forgejo/workflows/workflow.yaml

58 lines
1.7 KiB
YAML
Raw Normal View History

on: [push]
jobs:
Clone and Build:
runs-on: website
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: main
repository: Musselman/Notatio
- name: Get latest tag
run: |
tagOutput=$(git describe --abbrev=0 --tags || true)
if [ -z "$tagOutput" ] || [ "$tagOutput" == "fatal: No names found, cannot describe anything." ]; then
TAG='latest'
echo "No tags found, using default tag: $TAG"
else
TAG=$tagOutput
echo "Latest tag found: $TAG"
fi
- name: Building..
run: |
go build
- name: Testing..
run: |
echo "No Testing to do currently.."
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
notatio/notatio
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Cleanup:
runs-on: website
steps:
- name: Cleanup image
run: |
podman rmi -a -f