aktivisda/.forgejo/workflows/build.yml

53 lines
1.6 KiB
YAML
Raw Permalink Normal View History

2025-03-08 18:44:09 -05:00
name: Build And Publish Docker
on:
workflow_dispatch
jobs:
build:
container:
image: node:lts-bookworm
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
2025-03-08 18:51:17 -05:00
2025-03-08 18:44:09 -05:00
- name: Install deps
2025-03-08 18:51:17 -05:00
run: |
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
apt update && apt install -y jq
2025-03-08 18:44:09 -05:00
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to Self-Hosted Registry
uses: docker/login-action@v3
with:
registry: fung.uy
username: ${{ secrets.MYCO_REGISTRY_USER }}
password: ${{ secrets.MYCO_PERSONAL_ACCESS_TOKEN }}
- name: Get tags from GitLab repository
id: get_tags
2025-03-08 18:59:39 -05:00
run: |
latest_tag=$(curl -s https://framagit.org/api/v4/projects/74246/repository/tags | grep -o -E 'v[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)
2025-03-08 19:05:12 -05:00
if [ -z "$latest_tag" ]; then
echo "No valid tag found. Exiting."
exit 1
fi
2025-03-08 18:59:39 -05:00
echo "Latest version is $latest_tag"
2025-03-08 19:05:12 -05:00
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
2025-03-08 18:44:09 -05:00
2025-03-08 19:35:42 -05:00
- name: Set base image to latest
2025-03-08 19:44:04 -05:00
run: sed -i 's/FROM ubuntu:22.10/FROM ubuntu:latest/' ./aktivisda/server/dockerfile
2025-03-08 19:35:42 -05:00
2025-03-08 18:44:09 -05:00
- name: Build and Push with Latest Tag
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./aktivisda/server
2025-03-08 19:44:04 -05:00
file: ./aktivisda/server/dockerfile
2025-03-08 18:44:09 -05:00
platforms: linux/amd64
push: true
2025-03-08 19:05:12 -05:00
tags: fung.uy/mirrors/aktivisda:${{ env.latest_tag }}