42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
name: Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Forgejo Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.mcintire.me
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Generate image tags
|
|
id: tags
|
|
run: |
|
|
TIMESTAMP=$(date +%s)
|
|
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
|
TAG="main-${TIMESTAMP}-${SHORT_SHA}"
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
echo "Building image with tag: ${TAG}"
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
git.mcintire.me/graham/aprs.me:${{ steps.tags.outputs.tag }}
|
|
git.mcintire.me/graham/aprs.me:latest
|
|
cache-from: type=registry,ref=git.mcintire.me/graham/aprs.me:latest
|
|
cache-to: type=inline
|