From 992bbac7ac6124214a5b1805b55e9dbc3af6e7eb Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 22 Apr 2024 01:38:00 -0500 Subject: [PATCH] Use Gitlab CI for buiding --- .drone.yml | 9 ------ .github/workflows/deploy.yml | 28 ---------------- .github/workflows/k8s.yml | 62 ------------------------------------ .gitlab-ci.yml | 15 +++++++++ 4 files changed, 15 insertions(+), 99 deletions(-) delete mode 100644 .drone.yml delete mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/k8s.yml create mode 100644 .gitlab-ci.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 28190f1..0000000 --- a/.drone.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -kind: pipeline -type: exec -name: Build in Hugo -steps: - - name: Build - commands: - - podman build --rm --tag homepage:latest . - - systemctl restart podman-homepage.service diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 86901c1..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Build site and deploy - -on: push - -jobs: - build: - name: Build site and deploy - runs-on: ubuntu-20.04 - strategy: - matrix: - version: - - "0.92.0" - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Install Hugo - run: | - wget https://github.com/gohugoio/hugo/releases/download/v${{ matrix.version }}/hugo_extended_${{ matrix.version }}_Linux-64bit.tar.gz - tar xaf *.tar.gz hugo - - name: Build site - run: | - set -ex - ./hugo -v - ./hugo -v deploy --maxDeletes -1 - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/k8s.yml b/.github/workflows/k8s.yml deleted file mode 100644 index 71ab8bc..0000000 --- a/.github/workflows/k8s.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Container Build - -env: - # 🖊️ EDIT to change the image registry settings. - # Registries such as GHCR, Quay.io, and Docker Hub are supported. - IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} - IMAGE_REGISTRY_USER: ${{ github.actor }} - IMAGE_REGISTRY_PASSWORD: ${{ github.token }} - -on: - # https://docs.github.com/en/actions/reference/events-that-trigger-workflows - push: - branches: - - main - -jobs: - container-build: - name: Build and deploy container to registry - runs-on: ubuntu-20.04 - - steps: - - - name: Check out repository - uses: actions/checkout@v2 - with: - submodules: true - - - name: Determine timestamp - id: time - uses: nanzm/get-time-action@v1.1 - with: - format: 'YYYYMMDDHHmm' # Minute granularity timestamp for versioning - - - name: Build from Containerfile - id: build-image - uses: redhat-actions/buildah-build@v2 - with: - image: homepage - tags: ${{ steps.time.outputs.time }} latest - containerfiles: | - ./Containerfile - - - name: Push to registry - id: push-image - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.build-image.outputs.image }} - tags: ${{ steps.build-image.outputs.tags }} - registry: ${{ env.IMAGE_REGISTRY }} - username: ${{ env.IMAGE_REGISTRY_USER }} - password: ${{ env.IMAGE_REGISTRY_PASSWORD }} - - - name: Configure access to k8s - uses: azure/k8s-set-context@v2 - with: - method: kubeconfig - kubeconfig: ${{ secrets.KUBECONFIG }} - - - name: Update deployment to new image version - run: | - set -e -o pipefail - kubectl set image -n sites deployments/www www=${{ env.IMAGE_REGISTRY }}/${{ steps.build-image.outputs.image }}:${{ steps.time.outputs.time }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a4ba4e5 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,15 @@ +stages: + - build + - deploy + +build: + stage: build + tags: + - nix + - podman + script: + - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - nix build . + - podman load -i result + - podman tag "localhost/gregs-homepage:latest" $CI_REGISTRY/greg/homepage/gregs-homepage:latest + - podman push $CI_REGISTRY/greg/homepage/gregs-homepage:latest