diff --git a/.forgejo/workflows/main.yaml b/.forgejo/workflows/main.yaml new file mode 100644 index 0000000..c1af71c --- /dev/null +++ b/.forgejo/workflows/main.yaml @@ -0,0 +1,21 @@ +on: [push] +jobs: + build: + runs-on: native + steps: + - name: Nix build + run: nix build "git+${{ env.GITHUB_SERVER_URL }}/${{ env.GITHUB_REPOSITORY }}?rev=${{ env.GITHUB_SHA }}" + - uses: actions/upload-artifact@v3 + with: + name: website + path: result/ + deploy: + runs-on: native + steps: + - uses: actions/download-artifact@v3 + - name: Deploy + if: env.GITHUB_REF_NAME == 'master' + run: MC_HOST_hot=${{ secrets.MC_HOST_HOT }} mc mirror --overwrite --remove website hot/libre-sh-scim-doc + - name: Deploy beta + if: env.GITHUB_REF_NAME == 'develop' + run: MC_HOST_hot=${{ secrets.MC_HOST_HOT }} mc mirror --overwrite --remove website hot/libre-sh-scim-doc-beta diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 6b2c0b9..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,46 +0,0 @@ -image: alpine:latest - -variables: - HUGO_VERSION: 0.79.0 - FOLDER: "public" - OBJECT_STORE_ENDPOINT: "hot-objects.liiib.re" - BUCKET: libre-sh-scim-doc - BETA_BUCKET: libre-sh-scim-doc-beta - -stages: - - build - - deploy - -workflow: - rules: - - if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH" - variables: - MC_HOST_hot: https://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@${OBJECT_STORE_ENDPOINT} - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - variables: - MC_HOST_hot: https://${BETA_AWS_ACCESS_KEY_ID}:${BETA_AWS_SECRET_ACCESS_KEY}@${OBJECT_STORE_ENDPOINT} - BUCKET: ${BETA_BUCKET} - -build: - stage: build - before_script: - - apk add --no-cache wget ca-certificates - - wget -O hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz - - tar xzf hugo.tar.gz hugo - - apk add --no-cache nodejs-current npm - script: ./hugo --minify - artifacts: - paths: - - public - -deploy: - stage: deploy - rules: - - if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH" - when: on_success - - when: manual - needs: ["build"] - image: - name: minio/mc - entrypoint: [""] - script: mc mirror --overwrite --remove ${FOLDER} hot/${BUCKET} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..235ac79 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1726838390, + "narHash": "sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "944b2aea7f0a2d7c79f72468106bc5510cbf5101", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bce7838 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + description = "libre.sh SCIM website"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.website = pkgs.stdenv.mkDerivation { + name = "website"; + src = self; + buildPhase = "${pkgs.hugo}/bin/hugo --minify"; + installPhase = "cp -r public $out"; + }; + + defaultPackage = self.packages.${system}.website; + devShells.default = pkgs.mkShell { packages = [ pkgs.hugo ]; }; + }); +}