diff --git a/.gitea/workflows/build-container.yml b/.gitea/workflows/build-container.yml new file mode 100644 index 0000000..bd160ef --- /dev/null +++ b/.gitea/workflows/build-container.yml @@ -0,0 +1,45 @@ +# Gitea Actions workflow for StarPunk +# Builds and pushes container images on version tags + +name: Build Container + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract registry URL + id: registry + run: | + # Extract hostname from server URL (remove protocol) + REGISTRY_URL=$(echo "${{ github.server_url }}" | sed 's|https://||' | sed 's|http://||') + echo "url=${REGISTRY_URL}" >> $GITHUB_OUTPUT + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ steps.registry.outputs.url }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Containerfile + push: true + tags: | + ${{ steps.registry.outputs.url }}/${{ github.repository }}:${{ github.ref_name }} + ${{ steps.registry.outputs.url }}/${{ github.repository }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index efb3eb9..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,40 +0,0 @@ -# GitLab CI/CD Pipeline for StarPunk -# Builds and pushes container images on version tags - -stages: - - build - -variables: - # Required for Docker-in-Docker - DOCKER_TLS_CERTDIR: "/certs" - # Use overlay2 driver for better performance - DOCKER_DRIVER: overlay2 - -# Build and push container image -build-container: - stage: build - image: docker:24 - services: - - docker:24-dind - # Only trigger on version tags (e.g., v0.9.5, v1.0.0) - rules: - - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/ - before_script: - # Login to GitLab Container Registry - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - script: - # Build the container image with both version and latest tags - - | - docker build \ - --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG \ - --tag $CI_REGISTRY_IMAGE:latest \ - --file Containerfile \ - . - # Push both tags to the registry - - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - - docker push $CI_REGISTRY_IMAGE:latest - # Cache Docker layers between builds - cache: - key: docker-$CI_COMMIT_REF_SLUG - paths: - - .docker-cache